Skip to content
Kristian Karl edited this page Apr 7, 2020 · 4 revisions

This is an example of 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: http://localhost:9966/petclinic/. It should display: alt text

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 are designed using GraphWalker Studio. The test design is divided into 5 models.

What you should expect when running the test is that Firefox will open, and that the test will start navigating around the Pet Clinic web site.

The video below shows the PetClinic test using maven from the command line:

mvn graphwalker:test

Video of PetClinc

Docker

Another way of running the same test is using docker. The advantage is that Firefox with the 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 installed on you machine. Currently 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 GraphWalker Studio, the models will be opened look like this:

The main model: PetClinic

Home

The Find Owners model

Find owners

The Veterinarians model

Veterinarians

The Owner Information model

Owner information

The New Owner model

New owner

Clone this wiki locally