Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Universal test flag

by ait (Friar)
on Jul 19, 2012 at 18:46 UTC ( #982685=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Universal test flag
in thread Universal test flag

Yeah, I should have answered separately because I was mostly answering to zwon, I apologize for that, but you shouldn't have turned this into a pissing contest either.

If you run your code differently under testing than you do in deployment, your tests probably aren't testing what you care about.

I understood you the first time around, but it's quite common to have several tests for the same piece of code, or have a test behave differently given certain test conditions (static, offline, live, etc.). More commonly this is done with skip blocks in the test code, but sometimes you don't have that option.

I found tobyink's approach the best because it would even allow to run the app for integral testing with certain parts shut-off. I don't see this any different that skipping tests from the test suite.


Comment on Re^5: Universal test flag
Re^6: Universal test flag
by chromatic (Archbishop) on Jul 19, 2012 at 19:06 UTC
    I found tobyink's approach the best because it would even allow to run the app for integral testing with certain parts shut-off. I don't see this any different that skipping tests from the test suite.

    The question is what's in control, the tests or something external.

    There may be confirmation bias here, but every time I've modified my code to add a branch to distinguish between testing and deployment, it's bitten me later. I'm even leery of using separate Catalyst configurations for testing and deployment because those differences exist (I do use those configurations and usually very productively, but they introduce a risk I'm still not completely comfortable with).

    As an intermediate step between "We don't have tests for this code" and "We have great tests for this code and we've refactored the code to be simple and testable and clean", debugging sections in the code are workable. I could live with them, as long as there's a plan to replace them with something better in the near future.

    You wrote about management and business priorities and you're right to mention that. Getting some working tests is better than having no working tests—but even so, I just can't convince myself to have a lot of confidence in those tests until the differences between the code running under testing and the code running when deployed are minimal.

    (That's why I use very, very minimal mock objects.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982685]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-07-13 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls