AltWalker model-based testing example, implemented in Python, using the demo PetClinic site as a target.
This repository contains a Model-Based Testing (MBT) example for AltWalker, based on the "famous" PetClinic web application. This tutorial is essentially a Python port of a Java example originally created for GraphWalker, with some adaptations and cleanup. You can find some information about the models in the GraphWalker documentation.
- Python3
- Firefox (or other browser)
To install the required Python dependencies, run:
pip install -r requirements.txt
To start the PetClinic demo app, follow these steps:
-
Clone the PetClinic repository:
git clone https://github.com/SpringSource/spring-petclinic.git cd spring-petclinic git checkout 4926e292700f79260a58d6faf55b232ce075b70e
-
Start the PetClinic app with Maven:
./mvnw package java -jar target/*.jar
You can then access PetClinic demo at http://localhost:8080/.
You can validate the models and code using the following commands.
To check model syntax:
altwalker check -m models/petclinic.json "random(vertex_coverage(100))"
To verify the models against test scripts:
altwalker verify -m models/petclinic.json tests
To run the tests, use the following command:
altwalker online tests -m models/petclinic.json "random(vertex_coverage(100))" --report-xml-file altwalker.xml
If you intend to run this in a CI/CD pipeline or integrate it with a test management (e.g. Xray, Jenkins), AltWalker will generate a Junit XML report .
- Credit goes to Sergio Freire for porting this example to Python.
- Credit also goes to the GraphWalker team and the team behind the PetClinic example.
This project is licensed under the MIT License.