WebTest Module
ENTERPRISE This is a SignServer Enterprise feature.
Introduction
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:
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 below).
Configuration
Configuration File
The file conf/webtest.properties needs to be configured before executing web tests.
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.