This is an example on how to implement a test using the PetClinic Sample Application.
Pre-requisites
- Java JDK version 8 installed
- Maven installed (version equal or greater than 3.2.3)
- git installed
- Latest Firefox installed
Get and start the PetClinic Sample Application
git clone https://github.com/SpringSource/spring-petclinic.git
cd spring-petclinic
git reset --hard 482eeb1c217789b5d772f5c15c3ab7aa89caf279
mvn tomcat7:run
To verify that the Sample Application is running, open it: http://localhost:9966/petclinic/. It should display this:
Get and run the GraphWalker test example
git clone https://github.com/GraphWalker/graphwalker-example.git
cd graphwalker-example/java-petclinic
mvn graphwalker:test
The test
The tests is designed using yEd. The test design is divided between 5 models.
What you would expect when running the test, is that Firefox will open, and the test will start navigating around the Pet Clinic web site.
The video below runs the PetClinic test using maven from the command line:
mvn graphwalker:test
Another video that uses Graphstream to visualize the test as it runs. Graphstream is hooking into the GraphWalker Observer. The test is launched from IntelliJ.
Docker
Another way of running the same test, is using docker. The advantage is that Firefox with a specific version 47.0.1 is pre-installed, eliminating conflicts with newer versions of firefox and versions of selenium. Also, the petclinic webserver is installed and launched at startup automatically. You need to have docker installled on you machine. At this time, this is only confirmed to work on linux.
docker pull graphwalker/petclinic
docker run -ti --rm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/home/developer/.Xauthority \
--net=host --pid=host --ipc=host graphwalker/petclinic
The Models - The Test Design
The models can be found in folder:
src/main/resources/com/company/
When opened in yEd, the models will look like this: