The GraphWalker player, will visualize your tests progress on a single web page.
You need to add the GraphWalker Websocket Server to your test. There is an example in PetClinic
But in short, add the GraphWalker Websocket maven dependency to your test project:
<dependency>
<groupId>org.graphwalker</groupId>
<artifactId>graphwalker-websocket</artifactId>
<version>4.3.2</version>
</dependency>
Create the Websocket server and start it. See code below:
public static void main(String[] args) throws IOException, InterruptedException {
Executor executor = new TestExecutor(PetClinic.class,
FindOwners.class,
NewOwner.class,
OwnerInformation.class,
Veterinariens.class);
WebSocketServer server = new WebSocketServer(8887, executor.getMachine());
server.start();
Result result = executor.execute(true);
if (result.hasErrors()) {
for (String error : result.getErrors()) {
System.out.println(error);
}
}
System.out.println("Done: [" + result.getResults().toString(2) + "]");
}
The Websocket Sever will be started using the port 8887
in the example above.
- Download the index.html file to your computer.
- Add to the url where your test runs, and the port used by your tests Websocket server:
wsURI=localhost:8887
If your test runs on the same machine as your player, uselocalhost
, otherwise, use the IP address to the machine where your tests is running.
Complete URL could look like :file://<YOUR DOWNLOAD PATH ON YOUR COMPUTER>index.html?wsURI=<IP ADDRESS OF MACHINE RUNNING THE TEST>:<PORT USED BY WEBSOCKET SERVER IN YOUR TEST>
- Use that complete url in a web browser
- The player will automatically connect to your test when the test starts.
- Vertices and edges in light blue colors, are not yet visited (or executed by the test).
- When a vertex or edge is visited, it vill be colored light gray..
- An edge or vertex currently being executed by the test will be highlighted with a black border.
- When many models are used, the will be placed next to each other by the Player. In ranomd order, and using a grid layout for the individual model.
- The Player does not connect to the test.
Make sure that you have given the right address and port number.
Your url must end with thewsURI
parameter and data, for example:
file:///tmp//index.html?wsURI=localhost:8887
where?wsURI=localhost:8887
is added to the url, if the test is running onlocalhost
and the WebSocket server is using8887
as the port number. - The Player does not connect to the test.
Make sure that your test could bind to the port when launching. Look out for the
java.net.BindException: Address already in use
Reload the Player in the browser, and wait a little while until the operating system releases the port, and then re-run your test.