for exactly the cases you describe there is the concept of "dataproviders"
which is a loop around your test method, which is then allowed to accept different input parameters based on an outside data source. http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers On Wed, 22 Jul 2009 06:17:20 -0700 (PDT), fab2008 <f.napole...@gmail.com> wrote: > I read the post you linked and I'm agree with some of the aspects discussed > there. > > In every case the number of my assertions is so high because in some cases > I > use a for to test a method against every possible input, so I have some > tests which have 40-60 assertions. In other I need to check the final > result after a certain number of method calls, and in that case I inserted > also intermediate asserts, this make assertion count high. Moreover some > tests has this kind of situation plus it has to be valid for three fixed > type of input, in that case I also inserted a for cycle that tests the > condition for all three types. I don't know if this is a bad practice but I > feel safer with this approach. > > In the other (normal) cases I have a pretty small number of assertions, I > think about 2-4 per test. > > > Dalibor Karlović wrote: >> >> On Wednesday 22 July 2009 03:51:29 fab2008 wrote: >> >>> I am able to run all tests with a single command: >>> >>> .........................I.................I............... 60 / 177 >>> .I.......................................................... 120 / 177 >>> .........................I.......I......I................ >>> >>> Time: 16 seconds >>> >>> OK, but incomplete or skipped tests! >>> Tests: 177, Assertions: 1876, Incomplete: 7. >> >> Unrelated, but those numbers don't seem right to me, you have about 10 >> assertions per test which is, as I've read discussed, WAY above what it >> should >> be. Some [1] argue that you should have one assertion per test, I >> personally >> find that too rigid and average at about 1.5 - 1.7. >> >> [1] http://is.gd/1HmFL >> >> -- >> Dado >> >>