WebDriver for recording a Gatling load test, from an existing TestBench test. Probably the easiest way to quickly record a scalability/load test for a Vaadin web application
Note! Latest development and fixes are currently done only for V24 and V23 branches (see the links to branches below). Feel free report an issue if you need fixes to older versions (v8 -- v14).
Note! V23 and V24 versions support alternative (CLI) approach of generating Gatling tests without a TestBench test: https://github.com/johannest/loadtestdriver/blob/v24/README.md#loadtest-cli
<dependency>
<groupId>org.vaadin.johannest</groupId>
<artifactId>loadtestdriver</artifactId>
<version>0.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.vaadin.johannest</groupId>
<artifactId>loadtestdriver</artifactId>
<version>0.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.vaadin.johannest</groupId>
<artifactId>loadtestdriver</artifactId>
<version>0.4.0</version>
<scope>test</scope>
</dependency>
Vaadin 8
<dependency>
<groupId>org.vaadin.johannest</groupId>
<artifactId>loadtestdriver</artifactId>
<version>0.2.11</version>
<scope>test</scope>
</dependency>
Verify that your application server works in your browser with your local IP address such as 192.168.12.3:8080. It is not enough that it works in localhost:8080
or 127.0.0.1:8080
because of a limitation of PhantomJS. For example, in case of WildFly you can use command line parameter -b 0.0.0.0
(https://bgasparotto.com/enable-wildfly-remote-access/)
Use LoadTestDriver instead of e.g. ChromeDriver in your TestBench test's setup method. It recommended to store reference to the driver instance to make it easy to access the API of the driver.
@Before
public void setUp() throws Exception {
loadTestDriver = new LoadTestDriverBuilder().
withIpAddress("your-real-local-ipv4-address").
withNumberOfConcurrentUsers(2).
withRampUpTimeInSeconds(2).
withTestName("Bakery_AddOrder").
withPath("C:\\dev\\gatling8").
withResourcesPath("C:\\dev\\gatling8\\resources").
withStaticResourcesIngnoring().
withTestRefactoring().
build();
setDriver(loadTestDriver);
// setDriver(new ChromeDriver());
}
Verify that the logged in user has write access to the directory(ies) specified above TestBench test setup.
LoadTestDriver stores a recorded scala script by default in the System's tmp-folder, but you can specify used output folder like in above example. Make sure that you have a write access to that folder. Note: Make sure you only run one test one time for the given directory and test name, othervice the resulting script might be broken.
private void openTestUrl() {
// opens URL http://your.local.ip.address:8080/ui
getDriver().get(LoadTestDriver.getLocalIpAddressWithPortAndContextPath(8080,"ui"));
}
Note: The local IP address API above might not always work! In that case you have to explicitly hard code your ip v4 address into the test
For example: mvn spring-boot:run -Pproduction
LoadTestDriver uses Gatling to record the load test with parameters given in Driver setup (see above), test is saved in the given destination (see above).