Test::QUnit ( YAPC::Asia 2010 zentooo )

Preview:

Citation preview

Test::QUnit - QUnit test via prove

YAPC 2010ID: @zentooo

JS のテストをどげんかせんとくん

Web UI CLI• YUI Test• QUnit• JSUnit

• JSpec• Jasmine

JS test with Web UI

ブラウザ開くのがめんどくさいブラウザ開くのがめんどくさいブラウザ開くのがめんどくさい

(Open browser manually sucks!)

JS test with CLI

ブラウザのエミュレーションって結局どうなん?

env.js とか結構いけるっぽい

(It depends on browser emulation.)

IntegratedJSTestDriver (http://code.google.com/p/js-test-driver/)

(Looks good, run from IDE and CUI,cross-browser)

             /)            ///)           / ,.= ゙ ''" /    /     i f   ,.r='"- '‐ つ___ _    こまけぇこたぁいいんだよ!!    /       /     _,.- '~‐ /⌒  ⌒\     /    ,i     , 二ニ⊃( ●) .  (●)\     /     ノ    il ゙フ ::::::⌒ ( __ 人 __ )⌒ ::::: \        , イ「ト、   ,!,!|       |r -|┬       |       /   i トヾヽ _/ ィ " \      ` ー '´     /

(Throw away minor details!)

要は CLI からブラウザ上のテストが叩ければそれでいいんだろ?

(I want to run my tests with CLI, but on my browser. That’s all.)

そんでもってテスト結果とか集計されれば言う事ないんだろ?

(Sexy formatted test result summarygives me extacy.)

それ Test::Qunit (ry

(I love you.)

Test::QUnit

1. Invoke test with MozRepl

2. Get JS test results with MozRepl::RemoteObject,then convert it to TAP format

use Test::QUnit;

qunit_remote(“http://path/to/qunit/test.html”) => run QUnit test on remote server

qunit_local(“/path/to/qunit.test.html”) => run QUnit test on local Plack server

Demo?

On github

http://github.com/zentooo/p5-test-qunit

Thank you!