Automated test generation?
I am currently writing a test for the report function the more functionality the project gets the more reports need to be written
in my reports of cases of getting multiple search parameters and constraints such as number of lines or such
now my question is, does anyone know how to automatically generate test cases for a function that has a well-known set of possible parameters using phpunit?
I've read about some tools like quickcheck for other languages ββbut is there automatic test generation for php? or who has a suggestion how to create tests automatically?
THH
source to share
Save the list of known parameters somewhere (in a dedicated file or in your unit-test source file, write a parameterized test case and iterate over the parameters.
source to share
To generate basic PHPUnit files from your classes, you can use the PHPUnit skeleton generator.
Download it from:
- Github: https://github.com/sebastianbergmann/phpunit-skeleton-generator
- Composer:
"phpunit/phpunit-skeleton-generator": "*"
- DDL:
wget https://phar.phpunit.de/phpunit-skelgen.phar
The documentation above: https://phpunit.de/manual/3.7/en/skeleton-generator.html
source to share
As Ionut mentioned, the skeleton generator is what you are looking for. Here's a good tutorial ...
Netbeans does it all with one click if you are so inclined .
source to share