ct-jsrt-test-maven-plugin
The ct-jsrt-test-maven-plugin provides a goal to execute the test frameworks inside PhantomJS .
Each of the test frameworks provided by map.apps has support for a special script, which is included in the maven plugin. This makes it possible to run the tests in a CI Server.
This section describes the configuration properties.
This plugin loads the runner.html pages inside the headless browser provided by PhantomJS.
PhantomJS is based on Chromium so the tests are executed like running in the Chrome browser.
|
Goals
help
Display help for the ct-jsrt-test-maven-plugin
.
> mvn de.conterra.jsrt:ct-jsrt-test-maven-plugin:<version>:help -Ddetail=true
Set the <version>
to your current ct-jsrt-test version, e.g: 1.0.0
Parameter | Default | Description |
---|---|---|
|
|
If true, display all settable properties for each goal. |
|
|
The name of the goal for which to show help. If unspecified, all goals are displayed. |
|
|
The number of spaces per indentation level, should be positive. |
|
|
The maximum length of a display line, should be positive. |
runTests
Executes PhantomJS and load the test pages.
Binds by default to test lifecycle.
<plugin>
<groupId>de.conterra.jsrt</groupId>
<artifactId>ct-jsrt-test-maven-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>runTests</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- wait a bit to let the server fully start up -->
<initialDelay>2000</initialDelay>
<!-- test execution should not be longer as 1 minute -->
<timeout>60000</timeout>
<!-- which test URL should be loaded -->
<tests>
<test>http://localhost:8080/resources/jsregistry/root/doh/1.9.1/runner.html?test=helloworld/tests/doh-all</test>
<test>http://localhost:8080/resources/jsregistry/root/intern-geezer/1.7.0/runner.html?test=helloworld/tests/intern-all</test>
</tests>
</configuration>
</plugin>
Parameter | Default | Description |
---|---|---|
|
|
A list of tests, pointing to URLs which run unit tests (runner.html). |
|
|
The time to wait before starting the first test. |
|
|
The maximal time to wait until a result is expected from the test page. |
|
|
The path to phantom js binary. Binary for Windows and Linux are included in the plugin. |
Example
A typical usage in a map.apps project is the combination with an automatic start of the jetty server:
<profile>
<id>run-js-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<executions>
<execution>
<id>jetty-start</id>
<phase>process-test-classes</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>jetty-stop</id>
<phase>prepare-package</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.conterra.jsrt</groupId>
<artifactId>ct-jsrt-test-maven-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>runTests</goal>
</goals>
</execution>
</executions>
<configuration>
<tests>
<test>http://localhost:8080/resources/jsregistry/root/intern-geezer/1.7.0/runner.html?test=helloworld/tests/intern-all</test>
</tests>
</configuration>
</plugin>
</plugins>
</build>
</profile>
The Maven command line is:
> mvn package -P run-js-tests