| 1 |
=head1 EXAMPLES |
| 2 |
|
| 3 |
=head2 Running Tests in Multiple Languages |
| 4 |
|
| 5 |
If you have ruby installed in C</usr/bin/ruby>, and also have |
| 6 |
C<Test::WWW::Mechanize> installed, you can cd into C<examples/> (the directory |
| 7 |
where this README lives) and run the following command after installing the |
| 8 |
C<runtests> utility: |
| 9 |
|
| 10 |
examples $ runtests --exec ./my_exec t -v - < test_urls.txt |
| 11 |
t/10-stuff..............Failed 1/6 tests |
| 12 |
(less 2 skipped tests: 3 okay) |
| 13 |
(1 test unexpectedly succeeded) |
| 14 |
t/ruby..................ok |
| 15 |
http://www.google.com/....ok |
| 16 |
http://www.yahoo.com/.....ok |
| 17 |
|
| 18 |
Test Summary Report |
| 19 |
------------------- |
| 20 |
t/10-stuff.t (Wstat: 256 Tests: 6 Failed: 1) |
| 21 |
Failed tests: 2 |
| 22 |
TODO passed: 6 |
| 23 |
uests skipped: 3-4 |
| 24 |
Files=4, Tests=10, 3 wallclock secs ( 0.92 cusr + 0.23 csys = 1.15 CPU) |
| 25 |
|
| 26 |
The C<my_exec> is a Perl program which tells the test harness how to execute |
| 27 |
any tests it encounters. |
| 28 |
|
| 29 |
The C<t> argument tells it to search in the C<t/> directory for any tests. |
| 30 |
One of the tests it finds is written in Ruby, but the C<my_exec> program tells |
| 31 |
it how to run this test. If you have Ruby installed but the test fails, try |
| 32 |
changing the path. If you don't have Ruby installed, you can simply comment |
| 33 |
out those lines in C<my_exec>, but the test will fail. |
| 34 |
|
| 35 |
The C<-> tells C<runtests> to read from C<STDIN> and C<test_urls.txt> is |
| 36 |
merely a list of URLs we wish to test. |
| 37 |
|
| 38 |
See the documentation for C<runtests> and C<TAP::Harness> for more |
| 39 |
information about how to use this. |
| 40 |
|
| 41 |
The C<-v> tells the harness to run in verbose mode. |
| 42 |
|
| 43 |
=head2 Custom Test Harnesses |
| 44 |
|
| 45 |
The C<tprove*> harnesses in the C<examples/bin/> directory are deprecated in |
| 46 |
favor of the new C<runtests>/C<TAP::Harness> tools. They are left in primary |
| 47 |
for curiosity sake, though you may find the C<tprove_gtk> one useful as a |
| 48 |
reference for how to create a GUI interface for C<TAP::Parser>. |
| 49 |
|
| 50 |
Instead, simple override the desired methods in C<TAP::Harness> to create |
| 51 |
your own custom test harness. Don't like how the summary report is formatted? |
| 52 |
Just override the C<&TAP::Harness::summary> method and use your new subclass: |
| 53 |
|
| 54 |
runtests --harness TAP::Harness::MyHarness |