Questions tagged [test-more]

CPAN Link

The purpose of this module is to provide a wide range of testing utilities. Various ways to say "ok" with better diagnostics, facilities to skip tests, test future features and compare complicated data structures. While you can do almost anything with a simple ok() function, it doesn't provide good diagnostic output.

24 questions
5
votes
1 answer

How to write unit test cases for a Perl script

I'm able to write unit tests test_case.t for a Perl Module ModuleOne.pm test_case.t use strict; use warnings; use Test::More; use Test::Cmd; use ModuleOne; # Included the module here my $ret = ModuleOne::methodone(args); is($ret->{val}, 1,…
Srikanth Jeeva
  • 3,005
  • 4
  • 38
  • 58
5
votes
1 answer

Devel::Cover merging coverage data for Perl scripts and modules

I'm having issues merging data for coverage on Perl scripts and modules.. Running Devel::Cover individually works just fine, but when I try to combine the data I lose statistics for just the Perl script not the module.. Let me explain.. I have a…
4
votes
0 answers

How to insert a Text at the end of truncated multile text? React Native

I'd like to understand how to add some Text/Button, etc. and the end of ellipsed text last line when we have a truncated multiline text for example: Some cool text we can read here and feel very positive emotions but there is a bit ...[Show…
Velidan
  • 5,526
  • 10
  • 48
  • 86
3
votes
1 answer

Fail to test the rendered output after a redirect from a DELETE route - Mojolicious

I currently expand my test suite to increase the test coverage. I want to test my controller and the html output that it renders, but I found a problem in using delete methods. Let me explain it in an example. I have a…
vikin9
  • 497
  • 4
  • 16
2
votes
1 answer

Test::More failing test with equal strings

Using perl 5.16 with the latest Test::More module. I got a unit test being called like is($ret, "ssh: connect to host 1.2.3.187 port 22: Network is unreachable\nCouldn't read packet: Connection reset by peer\n", "putFileWithSFTP bad server ret…
noah
  • 312
  • 2
  • 13
2
votes
2 answers

How can I pass prove (Test::More) an argument, e.g. an API URL?

Parts of my test suite relies on an API URL. Sometimes I want to run my test using another URL. Is there a way to pass this argument to prove, or would I need to edit the file that defined the API URL?
Anna
  • 2,645
  • 5
  • 25
  • 34
2
votes
2 answers

How can I intercept perl Test::More's BAIL_OUT() and continue the next test?

Perl's Test::More doesn't seem to offer built-in way to say "bail out of just this test script, and continue with the next one". You can exit() or die() but it doesn't give you very useful TAP output or prove output, just something like t/foo.pl …
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
2
votes
3 answers

Suppress passed test output in Test::More

I have a Perl unit test that outputs "ok" for every passed test. I find myself scrolling up and up to find the first failed test, since that's the only thing I'm interested in. I am using Test::More. use strict; use warnings; use JSONRegex; use…
mareoraft
  • 3,474
  • 4
  • 26
  • 62
2
votes
1 answer

Cannot detect source of 'factorial'. Why?

I am getting the following traceback when I try and prove factorial: Cannot detect source of 'factorial'! at /usr/share/perl/5.18/TAP/Parser/IteratorFactory.pm line 263. …
Stephen Rasku
  • 2,554
  • 7
  • 29
  • 51
2
votes
1 answer

How do I change the default Module::Build / Test::More directory from "lib" to something else?

Using the directory and file architecture in this Post on Perl Unit testing and Code Coverage (which btw was VERY helpful), I copied the files I'll be running unit tests and code coverage on into a new "lib" directory and it works like a…
2
votes
1 answer

How can I use Test::More and friends to automatically test inherited behavior?

Context: Say I have a few modules that inherit from each other (using old-school inheritance with base and parent, not Moose or similar). Foo::Bar inherits Foo, and Foo::Bar::Baz inherits Foo::Bar. All of these modules have test suites written with…
Zac B
  • 3,796
  • 3
  • 35
  • 52
2
votes
1 answer

Is it fine to write "skip() unless ok()" with Test::More?

I've gone through the documentation and can't find a definitive answer to my query. In a lot of my tests, the execution of a SKIP block is conditional to the success of a prior test. So, for example, this what I write: ok( @results > $threshold ,…
Zaid
  • 36,680
  • 16
  • 86
  • 155
1
vote
1 answer

Split Test::More suite into multiple files

I'm using Test::More to test my application. I have a single script, run_tests.pl, that runs all the tests. Now I want to split this into run_tests_component_A.pl and B, and run both test suites from run_tests.pl. What is the proper way of doing…
Anna
  • 2,645
  • 5
  • 25
  • 34
1
vote
1 answer

Negated is_deeply() function in Test::More

Test::More has is_deeply() and mentions in the documentation that it should be used instead of eq_array() or eq_hash() because it has better diagnostics, and it states ...They may be deprecated in future versions Now I'm replacing the use of…
MichielB
  • 4,181
  • 1
  • 30
  • 39
1
vote
1 answer

Report only failed tests in Test::More

I have a lot of checks for random generated data. How can I get report message only for failed tests and show nothing if check is ok?
Artem
  • 517
  • 1
  • 7
  • 24
1
2