[tap-l] Automated Javascript unit tests

David E. Wheeler david at kineticode.com
Sun Jun 7 23:31:15 GMT 2009


On Jun 6, 2009, at 5:32 PM, Michael G Schwern wrote:

> I've loved David Wheeler's use of TAP to natively test where no test  
> has gone
> before!  Namely Javascript <http://openjsan.org/doc/t/th/theory/Test/Simple/ 
> >
> and Postgres <http://pgtap.projects.postgresql.org/>.  But how to  
> automate them?
>
> Postgres isn't too hard, you can mung up something to run SQL and  
> feed the
> results to a TAP parser.

I'll probably be looking at Steve Purkis's work this week to add  
native PostgreSQL test running support to TAP::Harness.

> Javascript is harder.  You need to run it in a real
> browser, not some tinker toy, which is hard enough to automate.   
> Then you need
> to get the TAP, and only the TAP, out and feed it to a TAP parser.   
> This is a
> barrier to smoke testing Javascript.
>
> No more!  Employing Selenium Remote Control, Firefox, Test.Simple,
> WWW::Selenium and TAP::Parser I've put together a system which can  
> unit test
> Javascript along side the rest of your code.  (That's four, count  
> them, four
> languages: Java, Javascript, Perl and C++).
> http://use.perl.org/~schwern/journal/39088

LOL, I love this. I wish it was fast, but at least it's automated!

> And this is what's wonderful about TAP.  If you can run the tests  
> and capture
> the TAP stream you can tie anything together.  And the parts are
> interchangeable.  You can use some other Javascript TAP testing  
> library (such
> as.... and for example....) or TAP parser or Selenium driver.   
> They're just
> executing programs and piping text around.

Yep. TAP is genius.

Best,

David



More information about the tap-l mailing list