SlideShare ist ein Scribd-Unternehmen logo
1 von 61
Downloaden Sie, um offline zu lesen
TAP::Harness
                                 (+ friends)

                             by Steve Purkis




Friday, 27 January 2012
About Steve...
                     • Software developer & manager
                     • Sporadic TAP::Harness dev
                          •   did a lot of refactoring

                          •   redesigned the plugin framework w/David Wheeler

                          •   wrote the HTML formatter




Friday, 27 January 2012
What we’ll cover...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
Unit Tests?
                     • Surely you all write tests by now...
                     • right?




Friday, 27 January 2012
Why Test?
                     •    “Kwalitee”
                           •   measurable approximation of quality (http://qa.perl.org/phalanx/kwalitee.html)
                           •   prevent regressions
                           •   gives others confidence what you’ve written is working


                     •    developer aid
                           •   break solutions down into chunks
                           •   test your assumptions
                           •   gives you confidence each chunk is working (so you can forget about it and move onto the next chunk!)


                     •    team co-ordination
                           •   gives your team confidence what you’re committing is working
                           •   right up there with version control, bug tracking, dev environments & build tools




Friday, 27 January 2012
What’s TAP?
                     • “Test Anything Protocol”
                     • Grew from Perl’s test output format:
                              1..7
                              ok 1 - use Test::Approx;
                              ok 2 - equal strings
                              ok 3 - equal numbers
                              ok 4 - completely different strings
                              ok 5 - similar strings, 20% threshold
                              ok 6 - similar strings, 10% threshold
                              ok 7 - big strings, default threshold




                                                                      See: http://testanything.org/
Friday, 27 January 2012
What’s TAP?
                Origins
                =head1 AUTHORS

                Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure
                is, that it was inspired by Larry Wall's TEST script that came with perl
                distributions for ages. Numerous anonymous contributors exist. Andreas
                Koenig held the torch for many years, and then Michael G Schwern.
                  - http://cpansearch.perl.org/src/PETDANCE/Test-Harness-2.56/lib/Test/Harness.pm




                For more details:
                http://testanything.org/wiki/index.php/TAP_History




                                                                                           See: http://testanything.org/
Friday, 27 January 2012
What’s TAP?
                     • Now available in
                          many languages!

                     •    A few projects I find interesting:

                          •   node.tap

                          •   MyTAP

                          •   pgTAP

                          •   PHPUnit




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13         Optional TAP version, must come 1st         1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl             Comments start with #         not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13       Test Plan                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1        test status & identifier                                #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                       test description       #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!
                                          non-TAP: ignored by parser        # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                            Example 2
         TAP version 13                                                       1..3
         # Generated from test.pl                                             not ok 1 - get remote # TODO not yet implemented
         1..13                                                                #    Failed (TODO) test 'get remote'
         ok 1                                                                 #    at test.pl line 18.
         ok 2 - a good test                                                   not ok 2 - a bad test
         not ok 3 - a bad test                                                #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                        #    at test.pl line 11.
         #    at test.pl line 11.                                             Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                           ok 3 - a good test
         Oops, I printed to STDERR!                                           # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented    TODO directive
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                              http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!                       SKIP directive
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                            Example 2
         TAP version 13                                                       1..3
         # Generated from test.pl                                             not ok 1 - get remote # TODO not yet implemented
         1..13                                                                #    Failed (TODO) test 'get remote'
         ok 1                                                                 #    at test.pl line 18.
         ok 2 - a good test                                                   not ok 2 - a bad test
         not ok 3 - a bad test                                                #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                        #    at test.pl line 11.
         #    at test.pl line 11.                                             Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                           ok 3 - a good test
         Oops, I printed to STDERR!                                           # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info   custom directive
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore     stop testing   & parsing
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Structure
         Example 1                                                          Example 2
         TAP version 13                                                     1..3
         # Generated from test.pl                                           not ok 1 - get remote # TODO not yet implemented
         1..13                                                              #    Failed (TODO) test 'get remote'
         ok 1                                                               #    at test.pl line 18.
         ok 2 - a good test                                                 not ok 2 - a bad test
         not ok 3 - a bad test                                              #    Failed test 'a bad test'
         #    Failed test 'a bad test'                                      #    at test.pl line 11.
         #    at test.pl line 11.                                           Bail out! I can't take it anymore
         Oops, I printed to STDOUT!                                         ok 3 - a good test
         Oops, I printed to STDERR!                                         # Looks like you failed 1 test of 3 run.
         not ok 4 - get remote # TODO not yet implemented
         #    Failed (TODO) test 'get remote'
         #    at test.pl line 18.
         ok 5 # skip to the loo!
         ok 6 - open connection to server # MyDirective with more info
         # Looks like you planned 13 tests but ran 6.
         # Looks like you failed 1 test of 6 run.




                                                http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar




Friday, 27 January 2012
TAP Lifecycle




                             http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard




Friday, 27 January 2012
Why TAP?
                     • Advantages:
                          •   Simple

                          •   Human-readable

                          •   Easy to generate & parse

                          •   Widely used by the Perl community




Friday, 27 January 2012
What else is there?
                     • Similar output formats:
                          •   JUnit report (XML generated by most xUnit libs & other tools like
                              googletest)
                          •   SubUnit
                          -   probably many more that I don’t know of...




                     • Complementary tools:
                          •   A QA team ;-)
                          •   CI & Build tools (CPAN, Smolder, Hudson, buildbot, etc)

                          -   probably many more that I don’t know of...




Friday, 27 January 2012
Up Next...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
What’s TAP::Harness?
                     • A set of extensible tools that make it easy
                          to produce & consume TAP


                           -   prove cmdline utility

                           -   Module::Build & ExtUtils::MakeMaker hooks

                           -   Parser, Source Handlers & Formatters

                           -   Plugin framework




Friday, 27 January 2012
Using TAP::Harness?
                     •    You're already using it!
                          •   Several years ago Test::Harness became a compatibility wrapper around TAP::Harness
                          •   The old Test::Harness has been retired: it was getting hard to maintain & extend

                          •   Thanks to these fine folk:

                                      Michael G. Schwern
                                      Andy Lester
                                      Ovid
                                      Andy Armstrong
                                      Eric Wilhelm
                                      & more!




Friday, 27 January 2012
Using TAP::Harness?
                          prove                 from Perl
                            prove -l t            use TAP::Harness;

                                                  my @tests = glob( 't/*.t' );
                          Module::Build           my $harness = TAP::Harness->new({
                                                      formatter_class =>
                            perl Build.PL             'TAP::Formatter::JUnit',
                            ./Build test              merge => 1
                                                  });
                                                  $harness->runtests( @tests );
                          ExtUtils::MakeMaker
                            perl Makefile.PL
                            make test




Friday, 27 January 2012
Under the hood...
                                                                             TAP
                                            ...
                               prove                                               Formatter

                                                                             Console            File
                            Module::Build         Harness                    Color              plugins
  Backwards compatibility




                            EU::MakeMaker                   Parser                   Parser
                                                                                               SourceHandler
                                                                     Aggregator
              Test::Harness                                                             Perl              Executable
                                                                Lots of hidden
                                                               complexity here!          File                Handle

                                                                                        RawTAP                plugins




Friday, 27 January 2012
Class diagram notes
   Class diagram

   Red: plugins are available
separate plugin systems!

   prove & App::Prove
       
        
        
        
    
   TAP::Harness
   
       cmdline utility to run tests & display results
   
   
       main interface to TAP::*
   
       parses args
      
        
        
        
    
   
       loads formatter & sourcehandler plugins
   
       loads App::Prove plugins
 
         
        
    
   
       creates parsers
   
       kicks off TAP::Harness
 
           
        
    
   
       aggregates results
   
       
        
        
        
        
        
    
   
       formats data

   Parser
   
        
        
         
       
       
   
   Parser::Aggregator
         
      
       
        
   
   SourceHandlers
   
         1 parser per stream (ie: test script)
      
   
   
        collate results across many TAP streams
   
   
   
      what actually run your tests
   
         has lots of helpers, not shown here
        
   
   
        because: 1 parser per stream!
    
        
   
   
      or open a file...
   
         opens TAP stream
           
       
       
   
   
        
        
         
      
       
        
   
   
      stream input into the parser
   
         parses input as it arrives
 
       
       
   
   
        
        
         
      
       
        
   
   
         sends events to the aggregator
 
           




Friday, 27 January 2012
Customising?
                     • Write Plugins
                     • Sub-class




Friday, 27 January 2012
Available Extensions
                     • Plugins:
                          •   Formatters: JUnit, HTML, Spreadsheet, TextMate, TeamCity
                          •   Sources: pgTAP, MyTAP, PHP
                          •   Prove: Idempotent


                     • Known Subclasses
                          •   TAP::Harness::JUnit
                          •   TAP::Harness::Multiple


                     • Other tools
                          •   	

 TAP::Filter


                     • All as of Jan 2012...
Friday, 27 January 2012
Where’s T::H Going?
                     • Where is TAP::Harness going?
                           •   Obviously: ongoing maintenance releases
                           •   I’d like to see:
                               •    Multiple Formatters
                               •    Arbitrary plugin args




                     • The rest is up to you!
                           •   write plugins!
                           •   find bugs!
                           •   send patches!
                           •   get involved.




Friday, 27 January 2012
Up Next...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
App::Prove plugin...
                          package App::Prove::Plugin::Foo;
                            # From http://search.cpan.org/dist/Test-Harness/lib/App/Prove.pm#Sample_Plugin
                            # Sample plugin, try running with:
                            # prove -PFoo=bar -r -j3
                            # prove -PFoo -Q
                            # prove -PFoo=bar,My::Formatter

                           use strict;
                           use warnings;

                           sub load {
                               my ($class, $p) = @_;
                               my @args = @{ $p->{args} };
                               my $app = $p->{app_prove};

                                print "loading plugin: $class, args: ", join(', ', @args ), "n";

                                # turn on verbosity
                                $app->verbose( 1 );

                                # set the formatter?
                                $app->formatter( $args[1] ) if @args > 1;

                                # print some of App::Prove's state:
                                for my $attr (qw( jobs quiet really_quiet recurse verbose )) {
                                    my $val = $app->$attr;
                                    $val    = 'undef' unless defined( $val );
                                    print "$attr: $valn";
                                }

                                return 1;
                            }

                           1;


Friday, 27 January 2012
Formatter plugin...
         package TAP::Formatter::Text;                            package TAP::Formatter::Text::Session;

         use strict;                                              use strict;
         use warnings;                                            use warnings;

         use TAP::Formatter::Text::Session;                       sub new {
                                                                      my ( $class, $args ) = @_;
         sub new {                                                    my $self = bless {%$args}, $class;
             my ( $class, $args ) = @_;                           }
             my $self = bless {}, $class;
         }                                                        sub header {
                                                                      my ( $self ) = @_;
         sub prepare {                                                print "Test start: $self->{name}n";
             my ( $self ) = @_;                                   }
             print "getting prepared!n";
         }                                                        sub result {
                                                                      my ( $self, $result ) = @_;
         sub open_test {
             my ( $self, $test, $parser ) = @_;                        my $str = '';
             my $session = TAP::Formatter::Text::Session->new({        if ($result->is_test) {
                 name => $test                                    	     $str = $result->is_ok ? '+' : '!!';
             });                                                       } elsif ($result->is_comment) {
             $session->header;                                    	     $str = '#';
             return $session;                                          }
         }
                                                                       if ($result->has_directive) {
         sub summary {                                            	     $str .= '->';
             my ( $self, $test, $parser ) = @_;                        }
             print "Text plugin summary!n";                           print " $strt" . $result->as_string . "n";
         }                                                        }

         # shouldn't really need to create these...               sub close_test {
         for (qw( directives verbosity timer failures comments        my ( $self, $test, $parser ) = @_;
                  errors stdout color show_count normalize )) {       print "Session closed!n";
             eval "sub $_ {}";                                    }
         }
         1;                                                       1;
Friday, 27 January 2012
SourceHandler plugin...
    package TAP::Parser::SourceHandler::Web;
                                                                     sub make_iterator {
    use strict;                                                          my ($class, $source) = @_;
    use warnings;
                                                                          $class->_croak('$source->raw must be a scalar ref')
    use   File::Slurp qw( read_file );                                      unless $source->meta->{is_scalar};
    use   LWP::UserAgent;
    use   TAP::Parser::IteratorFactory;                                   my $file = ${ $source->raw };
    use   TAP::Parser::Iterator::Array;                                   my $uri = read_file( $file );
                                                                          chomp $uri;
    use base qw( TAP::Parser::SourceHandler );
                                                                          my $ua = LWP::UserAgent->new;
    TAP::Parser::IteratorFactory->register_handler( __PACKAGE__ );        $ua->agent("TAP-Parser-SourceHandler-Web/0.1 ");
                                                                          my $req = HTTP::Request->new(GET => $uri);
    sub can_handle {                                                      my $res = $ua->request($req);
        my ( $class, $src ) = @_;
        my $meta   = $src->meta;                                          # Check the outcome of the response
        my $config = $src->config_for( $class );                          $class->_croak("couldn't GET $uri: " . $res->status_line)
                                                                            unless $res->is_success;
          return 0 unless $meta->{is_file};
          if (my $ext = $meta->{file}->{ext}) {                           my $tap = [ split(/n/, $res->content) ];
    	      return 0.99 if $ext =~ /.ur[il]$/i;                            my $iterator = TAP::Parser::Iterator::Array->new($tap);
          }
                                                                          return $iterator;
          return 0;                                                  }
    }
                                                                     1;




Friday, 27 January 2012
Module::Build
                • Using custom sources & formatters
                          my $build = Module::Build->new
                            (
                              ...
                              build_requires    => {
                          	                         'TAP::Harness' => '3.22',
                          	                         'Test::More'    => '0.01',
                          	                         'Module::Build' => '0.30',
                          	                         },

                               # TAP::Harness configuration
                               test_file_exts     => [qw(.t .tap .txt )],
                               use_tap_harness    => 1,
                               tap_harness_args   => {
                          	                            sources => {
                          	                                          Web => { },
                          	                                          File => {
                                                                               extensions => ['.tap', '.txt'],
                          	                                                  },
                                                                    },
                                                        color => 1,
                                                        formatter_class => 'TAP::Formatter::Text',
                          	                           },

                              );




Friday, 27 January 2012
Up Next...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
TAP::Formatter::HTML




                          Interpret your test results with HTML
                               Based on Yuval Kogman’s Test::TAP::HTMLMatrix


Friday, 27 January 2012
Friday, 27 January 2012
Friday, 27 January 2012
Common uses
                     • Integration tests
                     • Nightly smokes
                     • Being lazy
                      • avoid scrolling through tonnes of output



Friday, 27 January 2012
Demo
                     • Download from CPAN
                     • runprove -m -Q -P HTML=outfile:output.html




Friday, 27 January 2012
Up Next...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
Meet Hudson
                     • Free Java CI
                           servlet
                          - http://hudson-ci.org/
                     •    Consumes JUnit XML
                          reports

                     •    Provides useful stats &
                          reports




Friday, 27 January 2012
JUnit XML?
                     • Lots of build tools unit test frameworks
                          use it!
                     • Current options for TAP::Harness:
                           •   TAP::Harness::JUnit
                           •   TAP::Formatter::JUnit (alpha)




Friday, 27 January 2012
Demo
                     • 3 build tasks:
                      • TAP::Harness::JUnit
                      • TAP::Formatter::JUnit
                      • TAP::Formatter::HTML



Friday, 27 January 2012
Hudson config
                TAP::Harness::JUnit:
                Execute:
                  cd /Users/spurkis/dev/Perl-accessors
                  # For DEMO ONLY:
                  # avoid running perl here; defaults to junit_output.xml
                  # so just move the file to Hudson's workspace
                  prove -l --harness TAP::Harness::JUnit || echo 1
                  mv junit_output.xml "$WORKSPACE/test-report-$BUILD_ID.xml"
                Publish JUnit test report: test-report*.xml



                TAP::Formatter::JUnit:
                Execute:
                  cd /Users/spurkis/dev/Perl-accessors
                  prove -l --formatter TAP::Formatter::JUnit > "$WORKSPACE/test-report-$BUILD_ID.xml"
                Publish JUnit test report: test-report*.xml



                TAP::Formatter::HTML:
                Prep:
                  cp /usr/local/perl-5.10.1/lib/site_perl/5.10.1/TAP/Formatter/HTML/*.[cj]s* $HUDSON_HOME/userContent
                Execute:
                  cd /Users/spurkis/dev/Perl-accessors
                  prove -lm -P HTML=outfile:$WORKSPACE/test-report-$BUILD_ID.html,force_inline_css:0,css_uri:/userContent/default_page.css,css_uri:/
                  userContent/default_report.css,js_uri:/userContent/jquery-1.4.2.min.js,js_uri:/userContent/jquery.tablesorter-2.0.3.min.js,js_uri:/
                  userContent/default_report.js
                Archive artifacts: test-report*.html




Friday, 27 January 2012
That’s all...
                     • What’s TAP?
                     • TAP::Harness Overview
                     • Plugins & Module::Build integration
                     • TAP::Formatter::HTML
                     • TAP & Hudson CI


Friday, 27 January 2012
See Also
http://testanything.org/
http://search.cpan.org/dist/Test-Harness/
http://search.cpan.org/dist/Test-Harness/lib/TAP/Harness/Beyond.pod
http://search.cpan.org/dist/TAP-Formatter-HTML/
http://search.cpan.org/dist/TAP-Formatter-JUnit/
http://search.cpan.org/dist/TAP-Harness-JUnit/
http://search.cpan.org/dist/Smolder/
http://hudson-ci.org/




Friday, 27 January 2012
Questions
                          Test::Harness Developers
                            tapx-dev@hexten.net
                               patches welcome!

                                  Steve Purkis
                               spurkis@cpan.org




Friday, 27 January 2012
Ideas: Future Topics
                • Extending TAP: adding a custom
                          TAP::Parser::Result
                • Creating a new TAP::Parser::Grammar
                • Map of TAP::Parser internals



Friday, 27 January 2012

Weitere ähnliche Inhalte

Was ist angesagt?

Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214David Rodenas
 
TDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingTDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingDavid Rodenas
 
Testing: ¿what, how, why?
Testing: ¿what, how, why?Testing: ¿what, how, why?
Testing: ¿what, how, why?David Rodenas
 
Agile analysis development
Agile analysis developmentAgile analysis development
Agile analysis developmentsetitesuk
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
Madrid JAM limitaciones - dificultades
Madrid JAM limitaciones - dificultadesMadrid JAM limitaciones - dificultades
Madrid JAM limitaciones - dificultadesJavier Delgado Garrido
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaEddy Reyes
 
Introduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefIntroduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefAhmed Shreef
 
ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataDavid Rodenas
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) CodeOps Technologies LLP
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven DevelopmentJohn Blum
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 
TDD Walkthrough - Encryption
TDD Walkthrough - EncryptionTDD Walkthrough - Encryption
TDD Walkthrough - EncryptionPeterKha2
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)nedirtv
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionDionatan default
 
Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Manjula03809891
 

Was ist angesagt? (20)

Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214
 
TDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingTDD CrashCourse Part1: Testing
TDD CrashCourse Part1: Testing
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
Testing: ¿what, how, why?
Testing: ¿what, how, why?Testing: ¿what, how, why?
Testing: ¿what, how, why?
 
Agile analysis development
Agile analysis developmentAgile analysis development
Agile analysis development
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Madrid JAM limitaciones - dificultades
Madrid JAM limitaciones - dificultadesMadrid JAM limitaciones - dificultades
Madrid JAM limitaciones - dificultades
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
 
ES3-2020-05 Testing
ES3-2020-05 TestingES3-2020-05 Testing
ES3-2020-05 Testing
 
Introduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefIntroduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed Shreef
 
ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game Kata
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
TDD Walkthrough - Encryption
TDD Walkthrough - EncryptionTDD Walkthrough - Encryption
TDD Walkthrough - Encryption
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in Action
 
Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?
 

Andere mochten auch

Introduction to Docker - What is it and how is it compared to VM's
Introduction to Docker - What is it and how is it compared to VM'sIntroduction to Docker - What is it and how is it compared to VM's
Introduction to Docker - What is it and how is it compared to VM'sJeremy Haas
 
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...DreamBox Learning
 
Orchestrating Distributed Apps with Docker
Orchestrating Distributed Apps with DockerOrchestrating Distributed Apps with Docker
Orchestrating Distributed Apps with DockerCarl Su
 
Microservices using relocatable Docker containers
Microservices using relocatable Docker containersMicroservices using relocatable Docker containers
Microservices using relocatable Docker containersMauricio Garavaglia
 
Docker初识
Docker初识Docker初识
Docker初识hubugui
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Ruoshi Ling
 
Psychometric instrument development
Psychometric instrument developmentPsychometric instrument development
Psychometric instrument developmentJames Neill
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 

Andere mochten auch (11)

Introduction to Docker - What is it and how is it compared to VM's
Introduction to Docker - What is it and how is it compared to VM'sIntroduction to Docker - What is it and how is it compared to VM's
Introduction to Docker - What is it and how is it compared to VM's
 
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...
Finding What Works in Learning: Simple Ways to Analyze Education Research Stu...
 
TAP: Test Analysis Program
TAP: Test Analysis ProgramTAP: Test Analysis Program
TAP: Test Analysis Program
 
Orchestrating Distributed Apps with Docker
Orchestrating Distributed Apps with DockerOrchestrating Distributed Apps with Docker
Orchestrating Distributed Apps with Docker
 
Microservices using relocatable Docker containers
Microservices using relocatable Docker containersMicroservices using relocatable Docker containers
Microservices using relocatable Docker containers
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Docker初识
Docker初识Docker初识
Docker初识
 
Docker應用
Docker應用Docker應用
Docker應用
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
Psychometric instrument development
Psychometric instrument developmentPsychometric instrument development
Psychometric instrument development
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 

Ähnlich wie TAP-Harness + friends

Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Danny Preussler
 
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-BrockPragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-BrockJoseph Yoder
 
Pragmatic notdogmatictdd agile2012
Pragmatic notdogmatictdd   agile2012Pragmatic notdogmatictdd   agile2012
Pragmatic notdogmatictdd agile2012drewz lin
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easierChristian Hujer
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::ClassCurtis Poe
 
Test tutorial
Test tutorialTest tutorial
Test tutorialmsksaba
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentguy_davis
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Igalia
 
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Alex Balhatchet
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTokuhiro Matsuno
 
Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)Masaki Nakagawa
 
ChefConf2014 - Chef TDD
ChefConf2014 - Chef TDD ChefConf2014 - Chef TDD
ChefConf2014 - Chef TDD Daniel Tracy
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonCefalo
 

Ähnlich wie TAP-Harness + friends (20)

TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
IntroTestMore
IntroTestMoreIntroTestMore
IntroTestMore
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-BrockPragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
Pragmatic Not Dogmatic TDD Agile2012 by Joseph Yoder and Rebecca Wirfs-Brock
 
Pragmatic notdogmatictdd agile2012
Pragmatic notdogmatictdd   agile2012Pragmatic notdogmatictdd   agile2012
Pragmatic notdogmatictdd agile2012
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::Class
 
Getting testy with Perl
Getting testy with PerlGetting testy with Perl
Getting testy with Perl
 
Test tutorial
Test tutorialTest tutorial
Test tutorial
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
 
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and Testing
 
Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)
 
Test-Tutorial
Test-TutorialTest-Tutorial
Test-Tutorial
 
Test-Tutorial
Test-TutorialTest-Tutorial
Test-Tutorial
 
ChefConf2014 - Chef TDD
ChefConf2014 - Chef TDD ChefConf2014 - Chef TDD
ChefConf2014 - Chef TDD
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
Testing smells
Testing smellsTesting smells
Testing smells
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud Shaon
 

Mehr von Steve Purkis

Start the Wardley Mapping Foundation
Start the Wardley Mapping FoundationStart the Wardley Mapping Foundation
Start the Wardley Mapping FoundationSteve Purkis
 
Maps: a better way to organise
Maps: a better way to organiseMaps: a better way to organise
Maps: a better way to organiseSteve Purkis
 
Making sense of complex systems
Making sense of complex systemsMaking sense of complex systems
Making sense of complex systemsSteve Purkis
 
Glasswall Wardley Maps & Services
Glasswall Wardley Maps & ServicesGlasswall Wardley Maps & Services
Glasswall Wardley Maps & ServicesSteve Purkis
 
What do Wardley Maps mean to me? (Map Camp 2020)
What do Wardley Maps mean to me?  (Map Camp 2020)What do Wardley Maps mean to me?  (Map Camp 2020)
What do Wardley Maps mean to me? (Map Camp 2020)Steve Purkis
 
Introduction to Wardley Maps
Introduction to Wardley MapsIntroduction to Wardley Maps
Introduction to Wardley MapsSteve Purkis
 
COVID-19 - Systems & Complexity Thinking in Action
COVID-19 - Systems & Complexity Thinking in ActionCOVID-19 - Systems & Complexity Thinking in Action
COVID-19 - Systems & Complexity Thinking in ActionSteve Purkis
 
Predicting & Influencing with Kanban Metrics
Predicting & Influencing with Kanban MetricsPredicting & Influencing with Kanban Metrics
Predicting & Influencing with Kanban MetricsSteve Purkis
 
Map Your Values: Connect & Collaborate
Map Your Values: Connect & CollaborateMap Your Values: Connect & Collaborate
Map Your Values: Connect & CollaborateSteve Purkis
 
Modern agile overview
Modern agile overviewModern agile overview
Modern agile overviewSteve Purkis
 
Kanban in the Kitchen
Kanban in the KitchenKanban in the Kitchen
Kanban in the KitchenSteve Purkis
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasSteve Purkis
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLSteve Purkis
 
Entertaining pixie
Entertaining pixieEntertaining pixie
Entertaining pixieSteve Purkis
 

Mehr von Steve Purkis (15)

Start the Wardley Mapping Foundation
Start the Wardley Mapping FoundationStart the Wardley Mapping Foundation
Start the Wardley Mapping Foundation
 
Maps: a better way to organise
Maps: a better way to organiseMaps: a better way to organise
Maps: a better way to organise
 
Making sense of complex systems
Making sense of complex systemsMaking sense of complex systems
Making sense of complex systems
 
Glasswall Wardley Maps & Services
Glasswall Wardley Maps & ServicesGlasswall Wardley Maps & Services
Glasswall Wardley Maps & Services
 
What do Wardley Maps mean to me? (Map Camp 2020)
What do Wardley Maps mean to me?  (Map Camp 2020)What do Wardley Maps mean to me?  (Map Camp 2020)
What do Wardley Maps mean to me? (Map Camp 2020)
 
Introduction to Wardley Maps
Introduction to Wardley MapsIntroduction to Wardley Maps
Introduction to Wardley Maps
 
COVID-19 - Systems & Complexity Thinking in Action
COVID-19 - Systems & Complexity Thinking in ActionCOVID-19 - Systems & Complexity Thinking in Action
COVID-19 - Systems & Complexity Thinking in Action
 
Predicting & Influencing with Kanban Metrics
Predicting & Influencing with Kanban MetricsPredicting & Influencing with Kanban Metrics
Predicting & Influencing with Kanban Metrics
 
Map Your Values: Connect & Collaborate
Map Your Values: Connect & CollaborateMap Your Values: Connect & Collaborate
Map Your Values: Connect & Collaborate
 
Modern agile overview
Modern agile overviewModern agile overview
Modern agile overview
 
Kanban in the Kitchen
Kanban in the KitchenKanban in the Kitchen
Kanban in the Kitchen
 
Writing a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 CanvasWriting a Space Shooter with HTML5 Canvas
Writing a Space Shooter with HTML5 Canvas
 
High Availability Perl DBI + MySQL
High Availability Perl DBI + MySQLHigh Availability Perl DBI + MySQL
High Availability Perl DBI + MySQL
 
Entertaining pixie
Entertaining pixieEntertaining pixie
Entertaining pixie
 
Scalar::Footnote
Scalar::FootnoteScalar::Footnote
Scalar::Footnote
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

TAP-Harness + friends

  • 1. TAP::Harness (+ friends) by Steve Purkis Friday, 27 January 2012
  • 2. About Steve... • Software developer & manager • Sporadic TAP::Harness dev • did a lot of refactoring • redesigned the plugin framework w/David Wheeler • wrote the HTML formatter Friday, 27 January 2012
  • 3. What we’ll cover... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 4. Unit Tests? • Surely you all write tests by now... • right? Friday, 27 January 2012
  • 5. Why Test? • “Kwalitee” • measurable approximation of quality (http://qa.perl.org/phalanx/kwalitee.html) • prevent regressions • gives others confidence what you’ve written is working • developer aid • break solutions down into chunks • test your assumptions • gives you confidence each chunk is working (so you can forget about it and move onto the next chunk!) • team co-ordination • gives your team confidence what you’re committing is working • right up there with version control, bug tracking, dev environments & build tools Friday, 27 January 2012
  • 6. What’s TAP? • “Test Anything Protocol” • Grew from Perl’s test output format: 1..7 ok 1 - use Test::Approx; ok 2 - equal strings ok 3 - equal numbers ok 4 - completely different strings ok 5 - similar strings, 20% threshold ok 6 - similar strings, 10% threshold ok 7 - big strings, default threshold See: http://testanything.org/ Friday, 27 January 2012
  • 7. What’s TAP? Origins =head1 AUTHORS Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure is, that it was inspired by Larry Wall's TEST script that came with perl distributions for ages. Numerous anonymous contributors exist. Andreas Koenig held the torch for many years, and then Michael G Schwern. - http://cpansearch.perl.org/src/PETDANCE/Test-Harness-2.56/lib/Test/Harness.pm For more details: http://testanything.org/wiki/index.php/TAP_History See: http://testanything.org/ Friday, 27 January 2012
  • 8. What’s TAP? • Now available in many languages! • A few projects I find interesting: • node.tap • MyTAP • pgTAP • PHPUnit Friday, 27 January 2012
  • 9. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 10. TAP Structure Example 1 Example 2 TAP version 13 Optional TAP version, must come 1st 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 11. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 12. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl Comments start with # not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 13. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 14. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 Test Plan # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 15. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 16. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 test status & identifier # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 17. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 18. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test test description # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 19. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 20. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! non-TAP: ignored by parser # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 21. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 22. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented TODO directive # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 23. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 24. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! SKIP directive ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 25. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 26. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info custom directive # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 27. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 28. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore stop testing & parsing Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 29. TAP Structure Example 1 Example 2 TAP version 13 1..3 # Generated from test.pl not ok 1 - get remote # TODO not yet implemented 1..13 # Failed (TODO) test 'get remote' ok 1 # at test.pl line 18. ok 2 - a good test not ok 2 - a bad test not ok 3 - a bad test # Failed test 'a bad test' # Failed test 'a bad test' # at test.pl line 11. # at test.pl line 11. Bail out! I can't take it anymore Oops, I printed to STDOUT! ok 3 - a good test Oops, I printed to STDERR! # Looks like you failed 1 test of 3 run. not ok 4 - get remote # TODO not yet implemented # Failed (TODO) test 'get remote' # at test.pl line 18. ok 5 # skip to the loo! ok 6 - open connection to server # MyDirective with more info # Looks like you planned 13 tests but ran 6. # Looks like you failed 1 test of 6 run. http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard#Grammar Friday, 27 January 2012
  • 30. TAP Lifecycle http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard Friday, 27 January 2012
  • 31. Why TAP? • Advantages: • Simple • Human-readable • Easy to generate & parse • Widely used by the Perl community Friday, 27 January 2012
  • 32. What else is there? • Similar output formats: • JUnit report (XML generated by most xUnit libs & other tools like googletest) • SubUnit - probably many more that I don’t know of... • Complementary tools: • A QA team ;-) • CI & Build tools (CPAN, Smolder, Hudson, buildbot, etc) - probably many more that I don’t know of... Friday, 27 January 2012
  • 33. Up Next... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 34. What’s TAP::Harness? • A set of extensible tools that make it easy to produce & consume TAP - prove cmdline utility - Module::Build & ExtUtils::MakeMaker hooks - Parser, Source Handlers & Formatters - Plugin framework Friday, 27 January 2012
  • 35. Using TAP::Harness? • You're already using it! • Several years ago Test::Harness became a compatibility wrapper around TAP::Harness • The old Test::Harness has been retired: it was getting hard to maintain & extend • Thanks to these fine folk: Michael G. Schwern Andy Lester Ovid Andy Armstrong Eric Wilhelm & more! Friday, 27 January 2012
  • 36. Using TAP::Harness? prove from Perl prove -l t use TAP::Harness; my @tests = glob( 't/*.t' ); Module::Build my $harness = TAP::Harness->new({ formatter_class => perl Build.PL 'TAP::Formatter::JUnit', ./Build test merge => 1 }); $harness->runtests( @tests ); ExtUtils::MakeMaker perl Makefile.PL make test Friday, 27 January 2012
  • 37. Under the hood... TAP ... prove Formatter Console File Module::Build Harness Color plugins Backwards compatibility EU::MakeMaker Parser Parser SourceHandler Aggregator Test::Harness Perl Executable Lots of hidden complexity here! File Handle RawTAP plugins Friday, 27 January 2012
  • 38. Class diagram notes Class diagram Red: plugins are available separate plugin systems! prove & App::Prove TAP::Harness cmdline utility to run tests & display results main interface to TAP::* parses args loads formatter & sourcehandler plugins loads App::Prove plugins creates parsers kicks off TAP::Harness aggregates results formats data Parser Parser::Aggregator SourceHandlers 1 parser per stream (ie: test script) collate results across many TAP streams what actually run your tests has lots of helpers, not shown here because: 1 parser per stream! or open a file... opens TAP stream stream input into the parser parses input as it arrives sends events to the aggregator Friday, 27 January 2012
  • 39. Customising? • Write Plugins • Sub-class Friday, 27 January 2012
  • 40. Available Extensions • Plugins: • Formatters: JUnit, HTML, Spreadsheet, TextMate, TeamCity • Sources: pgTAP, MyTAP, PHP • Prove: Idempotent • Known Subclasses • TAP::Harness::JUnit • TAP::Harness::Multiple • Other tools • TAP::Filter • All as of Jan 2012... Friday, 27 January 2012
  • 41. Where’s T::H Going? • Where is TAP::Harness going? • Obviously: ongoing maintenance releases • I’d like to see: • Multiple Formatters • Arbitrary plugin args • The rest is up to you! • write plugins! • find bugs! • send patches! • get involved. Friday, 27 January 2012
  • 42. Up Next... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 43. App::Prove plugin... package App::Prove::Plugin::Foo; # From http://search.cpan.org/dist/Test-Harness/lib/App/Prove.pm#Sample_Plugin # Sample plugin, try running with: # prove -PFoo=bar -r -j3 # prove -PFoo -Q # prove -PFoo=bar,My::Formatter use strict; use warnings; sub load { my ($class, $p) = @_; my @args = @{ $p->{args} }; my $app = $p->{app_prove}; print "loading plugin: $class, args: ", join(', ', @args ), "n"; # turn on verbosity $app->verbose( 1 ); # set the formatter? $app->formatter( $args[1] ) if @args > 1; # print some of App::Prove's state: for my $attr (qw( jobs quiet really_quiet recurse verbose )) { my $val = $app->$attr; $val = 'undef' unless defined( $val ); print "$attr: $valn"; } return 1; } 1; Friday, 27 January 2012
  • 44. Formatter plugin... package TAP::Formatter::Text; package TAP::Formatter::Text::Session; use strict; use strict; use warnings; use warnings; use TAP::Formatter::Text::Session; sub new { my ( $class, $args ) = @_; sub new { my $self = bless {%$args}, $class; my ( $class, $args ) = @_; } my $self = bless {}, $class; } sub header { my ( $self ) = @_; sub prepare { print "Test start: $self->{name}n"; my ( $self ) = @_; } print "getting prepared!n"; } sub result { my ( $self, $result ) = @_; sub open_test { my ( $self, $test, $parser ) = @_; my $str = ''; my $session = TAP::Formatter::Text::Session->new({ if ($result->is_test) { name => $test $str = $result->is_ok ? '+' : '!!'; }); } elsif ($result->is_comment) { $session->header; $str = '#'; return $session; } } if ($result->has_directive) { sub summary { $str .= '->'; my ( $self, $test, $parser ) = @_; } print "Text plugin summary!n"; print " $strt" . $result->as_string . "n"; } } # shouldn't really need to create these... sub close_test { for (qw( directives verbosity timer failures comments my ( $self, $test, $parser ) = @_; errors stdout color show_count normalize )) { print "Session closed!n"; eval "sub $_ {}"; } } 1; 1; Friday, 27 January 2012
  • 45. SourceHandler plugin... package TAP::Parser::SourceHandler::Web; sub make_iterator { use strict; my ($class, $source) = @_; use warnings; $class->_croak('$source->raw must be a scalar ref') use File::Slurp qw( read_file ); unless $source->meta->{is_scalar}; use LWP::UserAgent; use TAP::Parser::IteratorFactory; my $file = ${ $source->raw }; use TAP::Parser::Iterator::Array; my $uri = read_file( $file ); chomp $uri; use base qw( TAP::Parser::SourceHandler ); my $ua = LWP::UserAgent->new; TAP::Parser::IteratorFactory->register_handler( __PACKAGE__ ); $ua->agent("TAP-Parser-SourceHandler-Web/0.1 "); my $req = HTTP::Request->new(GET => $uri); sub can_handle { my $res = $ua->request($req); my ( $class, $src ) = @_; my $meta = $src->meta; # Check the outcome of the response my $config = $src->config_for( $class ); $class->_croak("couldn't GET $uri: " . $res->status_line) unless $res->is_success; return 0 unless $meta->{is_file}; if (my $ext = $meta->{file}->{ext}) { my $tap = [ split(/n/, $res->content) ]; return 0.99 if $ext =~ /.ur[il]$/i; my $iterator = TAP::Parser::Iterator::Array->new($tap); } return $iterator; return 0; } } 1; Friday, 27 January 2012
  • 46. Module::Build • Using custom sources & formatters my $build = Module::Build->new ( ... build_requires => { 'TAP::Harness' => '3.22', 'Test::More' => '0.01', 'Module::Build' => '0.30', }, # TAP::Harness configuration test_file_exts => [qw(.t .tap .txt )], use_tap_harness => 1, tap_harness_args => { sources => { Web => { }, File => { extensions => ['.tap', '.txt'], }, }, color => 1, formatter_class => 'TAP::Formatter::Text', }, ); Friday, 27 January 2012
  • 47. Up Next... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 48. TAP::Formatter::HTML Interpret your test results with HTML Based on Yuval Kogman’s Test::TAP::HTMLMatrix Friday, 27 January 2012
  • 51. Common uses • Integration tests • Nightly smokes • Being lazy • avoid scrolling through tonnes of output Friday, 27 January 2012
  • 52. Demo • Download from CPAN • runprove -m -Q -P HTML=outfile:output.html Friday, 27 January 2012
  • 53. Up Next... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 54. Meet Hudson • Free Java CI servlet - http://hudson-ci.org/ • Consumes JUnit XML reports • Provides useful stats & reports Friday, 27 January 2012
  • 55. JUnit XML? • Lots of build tools unit test frameworks use it! • Current options for TAP::Harness: • TAP::Harness::JUnit • TAP::Formatter::JUnit (alpha) Friday, 27 January 2012
  • 56. Demo • 3 build tasks: • TAP::Harness::JUnit • TAP::Formatter::JUnit • TAP::Formatter::HTML Friday, 27 January 2012
  • 57. Hudson config TAP::Harness::JUnit: Execute: cd /Users/spurkis/dev/Perl-accessors # For DEMO ONLY: # avoid running perl here; defaults to junit_output.xml # so just move the file to Hudson's workspace prove -l --harness TAP::Harness::JUnit || echo 1 mv junit_output.xml "$WORKSPACE/test-report-$BUILD_ID.xml" Publish JUnit test report: test-report*.xml TAP::Formatter::JUnit: Execute: cd /Users/spurkis/dev/Perl-accessors prove -l --formatter TAP::Formatter::JUnit > "$WORKSPACE/test-report-$BUILD_ID.xml" Publish JUnit test report: test-report*.xml TAP::Formatter::HTML: Prep: cp /usr/local/perl-5.10.1/lib/site_perl/5.10.1/TAP/Formatter/HTML/*.[cj]s* $HUDSON_HOME/userContent Execute: cd /Users/spurkis/dev/Perl-accessors prove -lm -P HTML=outfile:$WORKSPACE/test-report-$BUILD_ID.html,force_inline_css:0,css_uri:/userContent/default_page.css,css_uri:/ userContent/default_report.css,js_uri:/userContent/jquery-1.4.2.min.js,js_uri:/userContent/jquery.tablesorter-2.0.3.min.js,js_uri:/ userContent/default_report.js Archive artifacts: test-report*.html Friday, 27 January 2012
  • 58. That’s all... • What’s TAP? • TAP::Harness Overview • Plugins & Module::Build integration • TAP::Formatter::HTML • TAP & Hudson CI Friday, 27 January 2012
  • 60. Questions Test::Harness Developers tapx-dev@hexten.net patches welcome! Steve Purkis spurkis@cpan.org Friday, 27 January 2012
  • 61. Ideas: Future Topics • Extending TAP: adding a custom TAP::Parser::Result • Creating a new TAP::Parser::Grammar • Map of TAP::Parser internals Friday, 27 January 2012