Am I a bad person if I use use Test::More qw(no_plan)
?
The Test::More POD says
Before anything else, you need a testing plan. This basically declares how many tests your script is going to run to protect against premature failure...
use Test::More tests => 23;
There are rare cases when you will not know beforehand how many tests your script is going to run. In this case, you can declare that you have no plan. (Try to avoid using this as it weakens your test.)
use Test::More qw(no_plan);
But premature failure can be easily seen when there are no results printed at the end of a test run. It just doesn't seem that helpful.
So I have 3 questions:
For really low-overhead projects, it's often optimal to test as few as 2 users per study. For some other projects, 8 users — or sometimes even more — might be better. For most projects, however, you should stay with the tried-and-true: 5 users per usability test.
The speed of detecting non-working code depends on the tools used for continuous integration. Tests can be set to run either a one-time check at a certain time interval or can be run immediately in real-time to review changes. In short, unit tests help developers detect problems immediately, then fix them quickly.
It usually varies. You can expect 1-2 tests to appear daily on your dashboard. Another factor that impacts the number of tests that you receive is your rating (testers with 5-star ratings tend to receive more tests), profile, and devices you own.
User testing will show you exactly which parts of your design frustrate people, where they get confused, and what keeps them from converting. It's a perfect complement to A/B testing and analytics, because it provides insights into why your users do what they do.
ysth's answer links to a great discussion of this issue which includes comments by Michael Schwern and Ovid who are the Test::More
and Test::Most
maintainers respectively. Apparently this comes up every once in a while on the perl-qa list and is a bit of a contentious issue. Here are the highlights:
Test::More
can count tests as they happenSKIP{}
block.Test::Simple
, Test::More
, and Test::Most
have a done_testing()
method which should be called at the end of the test script. This is the approach I take currently.
This fixes the problem where code has an exit(0)
in it. It doesn't fix the problem of logic which unintentionally skips tests though.
In short, its safer to use a plan, but the chances of this actually saving the day are low unless your test suites are complicated (and they should not be complicated).
So using done_testing()
is a middle ground. Its probably not a huge deal whatever your preference.
A few people mention that this feature has been useful to them in the real word. This includes Larry Wall. Michael Schwern says the feature originates with Larry, more than 20 years ago.
None of the xUnit type testing suites has the test plan feature. I haven't come across any examples of this feature being used in any other programming language.
I'm not sure what you are really asking because the documentation extract seems to answer it. I want to know if all my tests ran. However, I don't find that useful until the test suite stabilizes.
While developing, I use no_plan because I'm constantly adding to the test suite. As things stabilize, I verify the number of tests that should run and update the plan. Some people mention the "test harness" catching that already, but there is no such thing as "the test harness". There's the one that most modules use by default because that's what MakeMaker or Module::Build specify, but the TAP output is independent of any particular TAP consumer.
A couple of people have mentioned situations where the number of tests might vary. I figure out the tests however I need to compute the number then use that in the plan. It also helps to have small test files that target very specific functionality so the number of tests is low.
use vars qw( $tests ); BEGIN { $tests = ...; # figure it out use Test::More tests => $tests; }
You can also separate the count from the loading:
use Test::More; plan tests => $tests;
The latest TAP lets you put the plan at the end too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With