Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by Tux (Canon)
on Jun 01, 2010 at 10:59 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://842580]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-16 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found