Skip to main content
Skip table of contents

WebTest Module

ENTERPRISE

SignServer contains the enterprise module SignServer-Test-WebTest which holds Selenium driven web tests, performing automated testing of the web interface. Each test reflects the steps of a manual test from the internal SignServer test project (DSSQA).

Running Web Tests

To run all automated web tests, execute the following command in the SignServer directory:

CODE
bin/ant webtest

To run a single automated web test, execute the following command in the SignServer directory and replace DssQaXX_XXXXXX with the name of the test to execute:

CODE
bin/ant webtest -Dwebtest.single=DssQaXX_XXXXXX

Prerequisites

  • Fully installed SignServer instance with English language.
  • 64-bit Linux operating system.
  • Mozilla Firefox (tested with Firefox 60, older versions may cause issues).
  • JDK 8 or later.
  • Proper configuration (see Configuration).

Configuration

Configuration File

The files conf/webtest.properties and /test-config.properties  need to be configured before executing web tests.

Running against remote instance

In conf/webtest.properties there is webtest.remote.* properties that need to be modified to be able to run the webtests remotely.

The webtest.remote.keystore property path is not relative to the location of the tests. This means that you have to figure out and copy the keystore path on the remote machine.

Firefox User Profiles

Since Selenium cannot inject SSL certificates using the web driver, predefined User Profiles in Firefox are required. The first certificate available in each profile will be used and it is recommended to only import one certificate per profile to prevent test inconsistencies.

Start Firefox from a terminal with the command firefox -p and create a profile, then open the Firefox Preferences page (about:preferences) and import the certificate.

Creating Web Tests

For Selenium specific information, refer to the Selenium API Documentation.

Sample Test

The following displays a test example:

CODE
@FixMethodOrder(MethodSorters.NAME_ASCENDING) // Makes the test steps execute in the correct order
public class DssQa00_FooTest extends WebTestBase { // Tests should extend WebTestBase

    private static final String CLASS_NAME = DssQa00_FooTest.class.getSimpleName();

    @BeforeClass
    public static void init() {
        setUp(CLASS_NAME); // Performs the test setup and creates the WebDriver
    }

    @AfterClass
    public static void exit() {
        getWebDriver().quit(); // Closes the browser
    }

    @Test
    public void a_openAdminWeb() {
        WebTestHelper.openAdminWeb(); // Opens the SignServer AdminWeb
        AllWorkersHelper.clickWorkersTab(); // Clicks the 'Workers' tab
    }

    @Test
    public void b_workerExists() {
        AllWorkersHelper.assertWorkerExists("CMSSigner"); // Checks that a worker with the name 'CMSSigner' exists
    }
}

Helper Classes

If a piece of code can be useful for more than one test, it is recommended to put the code in one of the helper classes. Examples of reusable code are general actions such as adding a worker or editing a worker property.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.