Hiptest publisher samples with PHP/PHPUnit
In this repository you'll find tests generated in PHPUnit format from Hiptest, using Hiptest publisher.
The goals are:
- to show how tests are exported in PHP/PHPUnit.
- to check exports work out of the box (well, with implemented actionwords in PHP)
The SUT is a (not that much) simple coffee machine. You start it, you ask for a coffee and you get it, sometimes. But most of times you have to add water or beans, empty the grounds. You have an automatic expresso machine at work or at home? So you know how it goes :-)
You need PHP and PHPUnit to run generated tests. If you do not have them installed on your OS, the easiest way I found is to use the phpunit/phpunit docker image.
# pull PHPUnit docker image
docker pull phpunit/phpunit:5.0.3
# run tests
docker run -t -v $(pwd):/app phpunit/phpunit:5.0.3 tests
To update the tests:
hiptest-publisher --config phpunit.conf --only=tests
The tests are generated in tests/ProjectTest.php
To build the project and run the tests, use the following command:
phpunit --configuration config.xml --log-junit results.xml
The SUT implementation can be seen in src/CoffeeMachine.php
The test report is generated in results.xml