TAP over HTTP
JavaScript Perl Other
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
conf
egt
htdocs-devmode
htdocs
js
lib/Test
t
.gitignore
README.pod
demo

README.pod

NAME

HTtapTP - tools supported Test Anything Protocol over HTTP

DESCRIPTION

This tool arose from

  • some ad-hoc tests which loaded with JavaScript into an HTML table

  • the need to write some more tests with a similar interface

  • a Perl-world preference for TAP

The plan

  • enumerate TAP-producing URLs (not implemented here)

    There is an implementation in the team-internal webvm.git, which could benefit from liberation.

    It lists other backend servers from a nearby configuration file , then lists CGI scripts in a path relative to the $DOCUMENT_ROOT and assumes these are present everywhere. Then it draws a table of (server, TAP path) cells.

    See also "Finding tests".

  • generate TAP from CGI scripts

    While continuing to allow them to run directly under prove(1), and then noting that this ability can easily bit-rot because the test can be less convenient to run.

  • load and parse the TAP in the web browser

  • display neat green / red output

  • report the summary back to somewhere (not implemented)

  • extend prove(1) to let it fetch HTtapTP (not implemented)

    For now, I use this

    #! /bin/sh
    exec prove -e 'curl -s' "$@"

Screenshot is in htdocs-devmode/demo-screenshot-ed76dc.png .


Use in production

Another screenshot for the 2D test grid (test scripts vs. multiple webservers and their load-balancing front end proxies) is in htdocs-devmode/demo-screenshot-2D-24993a3d.png


The generator of this page is in a separate project. It would be good to make it available to others at some point - please ask if interested, but give some idea how the rows & columns should be discovered.

CAVEATS

  • Some parts of the TAP spec are not supported.

    The JavaScript library used now understands TODO failures, but there are other parts it does not.

    It would be possible to replace the JS library with another.

  • The global $SIG{__DIE__} shows up internal stuff in some code.

    https://rt.cpan.org/Ticket/Display.html?id=75390

    "plan" in Test::More skip_all

  • API is missing, to unify @ARGV and CGI params.

    Best to not use either?

    Several scripts I have written take CGI parameters. This means they no longer function as prove(1) scripts.

  • Subtests integration with PATH_INFO

    It also seems like it would be nice for a TAP script like /cgi-bin/mytest.t to be reachable with PATH_INFO like /cgi-bin/mytest.t/subtest_name in order to spread out the running and/or return results sooner.

    It's not clear that prove(1) has a counterpart to this.

  • No standard mechanism to enumerate tests remotely.

    The first application of this has CGI to enumerate tests and webservers, assume the set of tests is the same elsewhere, and draw a 2D grid. It is internal.

    prove(1) of course has direct access to the POSIX filesystem, to enumerate the tests.

  • Various issues with CORS.

    http://enable-cors.org/

    Passing cookies was problematic. I put them in the GET parameters from the generator of the page which enumerates tests.

FUTURE PLANS

Finding tests

There is a space here for some enumeration protocol, on which to standardise within this context.

  • allow remote TAP URL listing

  • allow detection of "subtest" in Test::More parts

    They could be called independently to increase responsiveness.

  • should not rely on HTTP directory listing

    This is frequently disabled for CGI script directories.

Reporting outcomes

Currently, results are displayed on screen but otherwise ephemeral.

It would be good to collect them somewhere, e.g. Tapper::Reports::Receiver, TAP::Harness::Archive.

POSTing back to the originating enumeration URL might make sense.

AUTHOR

Matthew Astley <mca@sanger.ac.uk>

COPYRIGHT

This project includes source code installed from

which have their own copyright statements and are currently in htdocs-devmode/ext-js/. The remainder of the code is

Copyright (c) 2013 Genome Research Ltd.
Author: Anacode team

Any redistribution or derivation in whole or in part including any
substantial portion of this code must include this copyright and
permission notice.

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at
your option) any later version (http://www.gnu.org/copyleft/gpl.txt).