2

currently im writing a test for a report function the more functionality the project gets the more reports need to be written

in my case reports get a few 'search' paramters and limitations like number of rows or such

now my question: anyone knows how to generate test cases automatically for a function which has a well known set of possible parameters using phpunit?

i read about some tools like quickcheck for other languages but does automated test generation exist for php? or anyone has a suggestion how to automatically create tests?

thx

4 Answers 4

5

PHPUnit has a test case class skeleton generator. Maybe it will help you.

4

Store the list of well-known parameters somewhere (in a dedicated file or in the unit-test source file, write a parameterized test-case and iterate over the parameters.

1
2

To generate basic PHPUnit files from your classes, you can use the PHPUnit skeleton generator.

Download it from :

Documentation is above : https://phpunit.de/manual/3.7/en/skeleton-generator.html

1

As alluded to by Ionut, skeleton generator is what you're looking for. Here's a nice tutorial...

Netbeans does it all with one click, if you're that way inclined.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.