[tap-l] Automated Javascript unit tests
Michael G Schwern
schwern at pobox.com
Sun Jun 7 00:32:50 GMT 2009
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. 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
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.
--
124. Two drink limit does not mean first and last.
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
http://skippyslist.com/list/
More information about the tap-l
mailing list