Questions tagged [perl-prove]

Perl's prove is a tool for customizing automatic tests and summarizing the results.

Perl's prove tool is a perl script for customizing automatic tests and summarizing the results. Because it is part of the Module Test::Harness, itself a perl core module, users will find prove pre-installed in the .../perl/bin directory.

Its documentation can be invoked from the command line with

prove --man

Output:

      prove - Run tests through a TAP harness.

 USAGE
       prove [options] [files or directories]

 OPTIONS ...

For detailed information on its many options, see the online documentation at https://metacpan.org/module/prove.

For a short listing of the options, type

prove --help

A more fundamental introduction, written by prove's author is available here:

https://metacpan.org/module/ANDYA/Test-Harness-3.23/lib/TAP/Harness/Beyond.pod:

[Slightly edited]

Beyond make test

Test::Harness is responsible for running test scripts, analysing their output and reporting success or failure. When I type make test (or ./Build test) for a module, Test::Harness is usually used to run the tests (not all modules use Test::Harness but the majority do).

To start exploring some of the features of Test::Harness I need to switch from make test to the prove command (which ships with Test::Harness). [...]

[L]ike make test, [prove] runs a test suite - but it provides far more control over which tests are executed, in what order and how their results are reported. ...

19 questions
14
votes
2 answers

Forking subprocesses in Perl unit tests stops prove; Test::Harness exiting

I have been trying to use the Perl utility/module "prove" as a test harness for some unit tests. The unit tests are a little more "system" than "unit" as I need to fork off some background processes as part of the test, Using the following... sub…
Vagnerr
  • 2,977
  • 3
  • 33
  • 46
10
votes
2 answers

How do I run Perl's ``prove`` TAP harness in unbuffered mode?

As part of a test suite written in Python 3[.4-.6] on Linux, I have to run a number 3rd-party tests. The 3rd-party tests are bash scripts. They are designed to run with Perl's prove TAP harness. One bash script can contain up to a few thousands of…
s-m-e
  • 3,433
  • 2
  • 34
  • 71
9
votes
1 answer

Raku: Read file in test folder when using prove6

When writing tests, text file gets read in the test folder but not outside the folder (i.e., when running prove6). For example, this code reads ReadConfig.ini inside the test folder, but not outside of it: my %v = ReadIni( 'ReadConfig.ini' ); On…
Mimosinnet
  • 743
  • 3
  • 8
7
votes
2 answers

How to run perl xt tests?

Lately the new great thing appeared in the Perl world. For a long time in the library package there was folder t that contained tests. Now there is one more folder xt that contains author test. The xt tests are not needed in the process of the…
bessarabov
  • 11,151
  • 10
  • 34
  • 59
6
votes
1 answer

How to run perl test in debugger mode?

I try to run test under debugger as: perl -d $(which prove) t/file.t But this has no effect because each test is run as separate job. I have found --exec option, but when I provide it I lost any option from .proverc file and command line prove…
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
6
votes
1 answer

What do the statistics (usr, sys, cusr, csys, and CPU) outputted by Perl's prove command mean?

I've done quite a bit of Googling but can't find an answer to this question. When you run prove on your tests (http://perldoc.perl.org/prove.html), you get some statistics that look like: Files=3, Tests=45, 2 wallclock secs ( 0.03 usr 0.00 sys + …
Keith Broughton
  • 487
  • 5
  • 9
6
votes
2 answers

How can I tell Perl's prove utility to ignore certain tests?

Currently I run prove like this: prove -v -r . Is there a way to exclude files using regex? I could not see that in perldoc prove or the output of prove -H.
kamal
  • 9,637
  • 30
  • 101
  • 168
5
votes
1 answer

Test fails under prove if it writes to stdout without newline

When I run a perl test using the prove utility, it fails if the method under test contains print statements that are not terminated by newlines. use Test::More tests=>1; ok(foo(), "calling foo"); sub foo{ print "A"; 1; } This results…
perlyking
  • 557
  • 7
  • 14
5
votes
2 answers

How to run same tests on different servers using prove?

I am using the Perl prove testing utility (TAP::Harness) to test my program. I need to run the same tests first on a local computer, then on a remote computer. (Test programs should connect to localhost or to remote host, respectively) How can I…
Oleg Razgulyaev
  • 5,757
  • 4
  • 28
  • 28
4
votes
2 answers

parameterization of perl *.t Prove existing tests

I have a bunch of perl tests: Functional Tests Mechanize Tests Actual Unit Tests, asserting on functions and return values, etc Tests that involve external Services, like WebServices DB centric tests REST tests I run all of them via prove and…
kamal
  • 9,637
  • 30
  • 101
  • 168
3
votes
1 answer

How to specify rules in .proverc?

The manpage of Perls prove tool says: Options in .proverc are specified in the same way as command line options: # .proverc --state=hot,fast,save -j9 This is not true, a rule specified as --rules='par=**' will work on the command line but is not…
lanti
  • 529
  • 3
  • 15
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
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

prove command not passing arguments after arisdottle to

I'm trying to pass some parameters to a test script through the prove command. Based on some old threads where is option was hashed out, and the content's of my prove's man page (quoted below), using :: before the options should work, but prove is…
Van J. Wilson
  • 166
  • 1
  • 7
2
votes
3 answers

How can I easily add the uninstalled Perl modules in my development directory to @INC?

I'm writing Perl t/*.t tests for an existing project. During development, I'd like to use 'prove' to run select tests at arbitrary depths in the module directory hierarchy. I've created some t/ directories at the same depth as the *.pm files I'd…
user70099
1
2