Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What is the largest number of tests you have created for a single project you have worked on?

by Tux (Abbot)
on Jun 01, 2010 at 10:59 UTC ( #842580=note: print w/replies, xml ) Need Help??


in reply to What is the largest number of tests you have created for a single project you have worked on?

I voted 10000-100000, but I don't know if tests in loops count the amount of times a tests is run, or the number of tests actually written (as in typed by hand).

use Test::More; is (1, 1, "test 1"); is (2, 2, "test 2"); is (3, 3, "test 3"); done_testing ();

vs

use Test::More; is ($_, $_, "test $_") for 1 .. 3; done_testing ();

As an example only. Generated tests can be complicated but useful.

foreach my $nl ("", "\n", "\r", "\r\n") { ok ($object->send ($text.$nl), "send"); is ($object->receive (), $text, "receive text without line ending" +); }

does this count as 2 or as 8?


Enjoy, Have FUN! H.Merijn
  • Comment on Re: What is the largest number of tests you have created for a single project you have worked on?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: What is the largest number of tests you have created for a single project you have worked on?
by Herkum (Parson) on Jun 10, 2010 at 15:03 UTC

    It is the number of tests executed that counts, not the number of statements. So for planning purposes in your first loop your test plan should be 3. The second test plan should be 8.

    That being said, I run tests with no_plan simply because counting the number of tests can be annoying to keep up with and I don't think it really adds much to the tests anyways. I rather put more time into test code coverage instead.

      Then switch to a newer Test::More, and use - as I did in my example - to the use of done_testing () and you don't have to count or use plans no more.

      done_testing () was first released in version 0.88 in May 2009, so it should be available to you too.

      Once you're comfortable with this new way of writing tests, you can even spend more time writing them without worrying if you missed count. Next step could be writing subtests :)


      Enjoy, Have FUN! H.Merijn
      Oh dear, I took a test to mean one test script.. Hmm.. what's a hundred times fifty? I feel that - really- tests should be relatively small- because stuff should be broken up into pieces of code- so.. if your project consists of ten classes, maybe each should be separated and tested into its own module/distro/package. I have a couple of packages that have maybe forty or fifty different test files, and i feel today that this is a failure in development.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://842580]
help
Chatterbox?
[talexb]: TStanley I'm flying to Vegas in two weeks time. After that flights leaving Vegas and Phoenix are late at night .. I've been hearing that it gets so hot that the air isn't dense enough for planes to take off. Weird. Guess you won't have that problem.
[Corion]: Yay, vacation time now - one week off work (but a Perl workshop in the middle ;)) )
[talexb]: TStanley I just realized that I was in your area for a convention back in April. We were at the high school for the weekend, the one with the long driveway. Nice spot.
[TStanley]: I am heading to Arlington, Virginia next week, then I get to spend an entire week at home. Looking forward to that as I will have spent 7 weeks on the road by the end of next week

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-06-23 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (548 votes). Check out past polls.