LanX has asked for the wisdom of the Perl Monks concerning the following question:
I'm doing some masstests with hundreds of thousands of random cases.
Is there an easy switch to make Test::More only report fails and stay silent with passes?
I could of course do those tests manually, but it would be nice to use the same test-suite against small number of manually generated cases.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Test::More to only report fails?
by hippo (Bishop) on Nov 06, 2021 at 16:33 UTC | |
I have a test suite which runs daily and I obviously don't want to be bothered hearing from it if everything passes :-). To that end I have used the facilities of TAP::Harness so that it only reports failures. Here's the (freshly anonymised) code:
This has been running daily from cron for a couple of years. Not quite what you asked for but perhaps a feasible alternative. HTH. 🦛 | [reply] [Watch: Dir/Any] [d/l] |
Re: Test::More to only report fails?
by choroba (Cardinal) on Nov 06, 2021 at 16:39 UTC | |
to select the failed tests (tested in XML::XSH2).
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [Watch: Dir/Any] [d/l] [select] |
by LanX (Saint) on Nov 06, 2021 at 17:10 UTC | |
In my case I'm randomly generating 1e6+ cases ...
Cheers Rolf | [reply] [Watch: Dir/Any] |
Re: Test::More to only report fails?
by jo37 (Deacon) on Nov 07, 2021 at 11:47 UTC | |
Lately I came across a similar issue. In my case tests were simple boolean values and I so struck to this construct:
This is quite simple but has some flaws:
For this purpose a new test tool is generated. It will execute a code block in the context of a subtest, dropping all passed assertion events. Any other event will be processed unmodified.
Now any tests may be used within drop_passing and these count as a single test. Though this won't be of much help for users of Test::More I'd like to share it anyway. Greetings, | [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Test::More to only report fails?
by stevieb (Canon) on Nov 06, 2021 at 15:56 UTC | |
This is a great question which I hope someone has a solution for. I think about this often, but never took the time to look into it. | [reply] [Watch: Dir/Any] |
Re: Test::More to only report fails?
by LanX (Saint) on Nov 06, 2021 at 19:53 UTC | |
... but it will still fill up $scalar with the passed tests. Does Perl have a generic /dev/null filehandle to ignore output like on linux?
editthis works on Win, but it's not generic
updateAh yes IO::Null is on cpan. :)
Cheers Rolf | [reply] [Watch: Dir/Any] [d/l] [select] |
by LanX (Saint) on Nov 06, 2021 at 21:36 UTC | |
Cheers Rolf | [reply] [Watch: Dir/Any] [d/l] [select] |
by Marshall (Canon) on Nov 07, 2021 at 01:50 UTC | |
With: I guess just check O/S and open either /dev/null or nul. NUL is a reserved file name on Windows. | [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Test::More to only report fails? (SOLVED)
by LanX (Saint) on Nov 07, 2021 at 09:22 UTC | |
Cheers Rolf | [reply] [Watch: Dir/Any] [d/l] [select] |