Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by atcroft (Monsignor)
on Jun 01, 2010 at 10:27 UTC ( #842572=poll: print w/ replies, xml ) Need Help??

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

Test??? There's a test?!? Oh. I didn't study!!!
[bar] 101/10%
Tests? What do you mean 'tests'?
[bar] 62/6%
Tests? I don't need no stinkin' tests-my code is flawless, you insensitive clod!
[bar] 86/9%
I'm afraid I haven't gotten into testing (yet).
[bar] 123/13%
I've forgotten.
[bar] 12/1%
I lost count.
[bar] 35/4%
I used 'no_plan' so I didn't have to count them.
[bar] 43/4%
0
[bar] 29/3%
Between 1 and 100
[bar] 195/20%
Between 100 and 1000
[bar] 137/14%
Between 1000 and 10,000
[bar] 75/8%
Between 10,000 and 100,000
[bar] 22/2%
Between 100,000 and 1,000,000
[bar] 15/2%
More than 1,000,000
[bar] 16/2%
Someone else lost a bet, and paid up by writing the tests for me.
[bar] 18/2%
Other
[bar] 9/1%
978 total votes
Comment on What is the largest number of tests you have created for a single project you have worked on?
Re: What is the largest number of tests you have created for a single project you have worked on?
by Tux (Monsignor) on Jun 01, 2010 at 10:59 UTC

    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

      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.
Re: What is the largest number of tests you have created for a single project you have worked on?
by moritz (Cardinal) on Jun 01, 2010 at 11:44 UTC
    The Perl 6 test suite has an estimated number of 40k to 50k tests, of which I've touched a signigifcant part, but only added a few thousand.

    Seeing the vast field of not-yet-test features and combinations of features, I guess we really need at least twice as many, possibly more.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: What is the largest number of tests you have created for a single project you have worked on?
by Ratazong (Prior) on Jun 01, 2010 at 13:10 UTC

    Nice poll!

    The responses show that we can still learn a lot from the master:

    Chuck Norris can unit test entire applications with a single assert.

    Have fun! Rata
Re: What is the largest number of tests you have created for a single project you have worked on?
by vitoco (Friar) on Jun 01, 2010 at 14:55 UTC

    The only test that counts is the one that would kill the project from someone else... Mua, ha, ha!

Re: What is the largest number of tests you have created for a single project you have worked on?
by Xilman (Friar) on Jun 01, 2010 at 16:19 UTC

    I voted 10K - 100K. Back in 1980 or so I wrote virtually all the microcode for the instruction set of a bit-sliced machine. By far the largest amount of microcode was the test set --- millions of lines of souce. Almost all of that was, of course, written automatically from templates.

    Paul

Re: What is the largest number of tests you have created for a single project you have worked on?
by ChuckularOne (Parson) on Jun 02, 2010 at 17:07 UTC
    Pah! Testing is a sign of weakness.
Re: What is the largest number of tests you have created for a single project you have worked on?
by Illuminatus (Curate) on Jun 02, 2010 at 18:11 UTC
    tests?!? We have hundreds, maybe thousands of customers testing our software. I have the phone-calls and bug-reports to prove it...

    fnord

Re: What is the largest number of tests you have created for a single project you have worked on?
by planetscape (Canon) on Jun 02, 2010 at 22:17 UTC

    Tests? It Works For Me...

    HTH,

    planetscape
Re: What is the largest number of tests you have created for a single project you have worked on?
by BrowserUk (Pope) on Jun 02, 2010 at 23:40 UTC

    Circa: 80 million. Though I admit I didn't actually write any of them.

    I did write the test case generator though, so it sort of counts.

Re: What is the largest number of tests you have created for a single project you have worked on?
by Kanishka.black0 (Beadle) on Jun 03, 2010 at 11:05 UTC
    Most of the code i wrote will end with in 50 -60 lines ... got used many subs as many as possiable .... more over i am not into testing
Re: What is the largest number of tests you have created for a single project you have worked on?
by eklerks (Novice) on Jun 03, 2010 at 12:03 UTC

    In the beginning of a project I start writing tests before coding, when the deadline comes nearby and my stresslevel starts peaking I start to omit them. Bad habit, but inevitable, when a manager made some interesting promises.

Re: What is the largest number of tests you have created for a single project you have worked on?
by blakew (Monk) on Jun 04, 2010 at 20:11 UTC
    I write lots of tests at $work. Nobody cares except me, when I come back to something and I forget how things are supposed to operate.
Re: What is the largest number of tests you have created for a single project you have worked on?
by pileofrogs (Priest) on Jun 04, 2010 at 20:16 UTC

    no_plan for me!

    For me, writing tests is all about the war between sloth and discipline. Anything that makes it easier to write tests, like not having to update that dumb number all the time, means more test get writ.

Re: What is the largest number of tests you have created for a single project you have worked on?
by biohisham (Priest) on Jun 05, 2010 at 04:20 UTC

    A great one atcroft...

    I am afraid I haven't gotten into testing (yet), though I wrote some applications here and there and not undermining the importance of testing as it seems to hold a sizable part in the development cycle I am yet to understand how to go about it, as a biologist randomness is a nice pond for discoveries, but as a programmer uncharacterized code behavior can be heckling and quite disruptive to mental resources....suggestions???



    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

      Here's one way to get started quickly with testing, in about 10 lines of code.

      I recently wrote my first tests to drive a Java CLI app, and the investment was repaid quickly when they were easily ported to a second project w/ a similar CLI. I spent less time manually testing, and was more confident about changing the code because I could quickly test it.

      The program has a simple command-line menu of about 10 items. I tested the program manually using that menu, which became tedious during development. So I looked at the excellent book: Perl Testing, A Developer's Notebook (ISBN 9780596100926). The section on Testing Interactive Programs in chapter 9 worked for me. (I had previously read the book and written a few tests. If you are new to testing, start at the beginning instead of the end, if necessary). The man pages for the test modules are also helpful.

      I needed Test::Expect for this solution. That required me to make a unique and consistent prompt string in the programs under test, which was a good thing.

      My first test looked like this:

      use strict; use warnings; use Test::More tests => 3; use Test::Expect; expect_run( command => "java -cp '.' src/TestRoster", prompt => " >: ", quit => "0\n", ); expect_send( '97', 'Ask for help'); expect_like( qr/-Help about the menu items.+Terminate.+/sm, '... show +s help text'); ...
      Test 1: print the program's Help menu:
      Initialize with expect_run(): the command to run the program under test; the expected prompt; and how to terminate it.
      Send the request from the test program (97); see the response at the console (the program's help text); write a regex in the test program to match the response (qr/.../). You now have a test.

      Run that Perl test program individually; or use 'prove' to run one or more tests, and to show a summary of the output.

      Write a test before you write the code for the next action. Run it, see it fail; write the code; run the test; repeat until no failures. You are now doing test-driven development.

      Thanks for the tip on 'done_testing()'.

Re: What is the largest number of tests you have created for a single project you have worked on?
by rjt (Deacon) on Jun 08, 2010 at 18:06 UTC

    Sometimes I find the tough sell to management is not so much the number of tests, but the ratio of test cases to original lines of code, or time spent writing tests.

Re: What is the largest number of tests you have created for a single project you have worked on?
by Discipulus (Curate) on Jun 16, 2010 at 07:52 UTC

    very interesting!! I' have not grown rationally in coding and I fail in tests writing.. more .. normally I code by my own at work like at home and seven on ten it ends with a quick and lazy hack; -w use strict; use this; use that; abracadabra! The others three times my lack in test writing skill make the difference between me an a serious prof coder.

    It remeber me the time when I was stucked wrinting a recursive dir walker .. atcroft it need an option more:
    tests? like uncommenting my print statements?!
    there are no rules, there are no thumbs..

      Wow! I was surprised when I looked at the current poll and found it to be my earlier suggestion. Just-wow.

      My original reason for the idea was that I had started myself a small project in late January: I wanted to write something to standardize the abbreviations used in a lengthy list of customer addresses where I work. I started with a listing of US Postal Service abbreviations, and began writing expressions to check for common variations and replace them. In doing so, I realized I could use the Test::* framework to generate tests to make sure none of the patterns I had created were too lax or too aggressive, plus it would give me a reason to play with testing, something that I too have not done as much of as I should. When my generated count of tests exceeded 1.0e4, I began to wonder how many tests others had created/generated/written, and thus the question I posted. (As for the project, I ran out of to-its with a full 10+ minute run of the tests (exceeding 5.8e5, including, at that point, 9 failures), probably several dozen expressions left to write, and the eventual intent to try my hand at morphing it into some kind of usable module.)

        613,026 tests (generated by the script), taking 11m:50s to run, and all passed. I'm surprised (on all counts)!

        By the way, are there any modules anyone could recommend that actually do what I seem to have originally intended when I started this, to be able to give it an address part (such as an address line, or a US state) using a possibly common abbreviation and return one in which the common but not standard abbreviations are replaced? Just curious.

Re: What is the largest number of tests you have created for a single project you have worked on?
by stonecolddevin (Vicar) on Jun 24, 2010 at 17:59 UTC

    Catalyst::Devel had a shit load before and has even MORE tests now after my Google Summer of Code project. Test::Aggregate ftw.

    mtfnpy

Re: What is the largest number of tests you have created for a single project you have worked on?
by tcurtis (Acolyte) on Jun 30, 2010 at 04:59 UTC
    $ prove t/library/past*.t
    t/library/pastpattern.t ............. ok         
    t/library/pasttransformer.t ......... ok   
    t/library/pasttransformerdynamic.t .. ok   
    t/library/pastwalker.t .............. ok   
    t/library/pastwalkerdynamic.t ....... ok   
    All tests successful.
    Files=5, Tests=2161, 18 wallclock secs ( 0.38 usr  0.05 sys + 16.40 cusr  0.66 csys = 17.49 CPU)
    Result: PASS
    

    2,161 as of right now. That number is probably about to go up significantly as I've recently re-factored the code in question a lot, and I haven't written new tests for some of the new functionality.

    It's Not Quite a Perl project, although it is a Not Quite Perl 6 project. It's a optimization and analysis framework, originally for Parrot Abstract Syntax Trees(which Parrot's Compiler Tools framework uses), but now rather easy to extend to any tree-like data structure.

View List Of Past Polls


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2014-10-30 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls