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).
Note!
The following files have been removed to help eliminate CVE exposure from the packaged distribution. If you need to run the WebTest module, you can still do so by manually adding these files under the lib/ext/ext folder before executing the tests.
geckodriver-v0.21.0-linux64.bin sha256sum:5423a6e514ea3c7a2dc464ee441c03543ccfe5b85c09081e62f41b3346097507
selenium-server-standalone-3.13.0.jar sha256sum:d03d5c3c8f292529fe235138756431cf1fc32ef9d0f76131c09b5366de4b3d99
You can get the files from SignServer GitHub repository https://github.com/Keyfactor/signserver-ce/tree/v7.3.2/signserver/lib/ext/ext
Running Web Tests
To run all automated web tests, execute the following command in the SignServer directory:
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:
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 find 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:
@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.