More Related Content
Similar to Java script testing framework for around html5 studies-
Similar to Java script testing framework for around html5 studies- (20)
Java script testing framework for around html5 studies-
- 20. QUnit
■コード(例
module("sync");
test("syncFuncTest", 1, function(){
equal("hello, world!", syncFunc(), "return to expected data");
});
module("async");
test("asyncFuncTest", function(){
expect(2);
stop();
asyncFunc(function(message){
start();
ok(true, "call to callback function");
equal("hello, world!", message, "return to expected data");
});
});
←非同期のテストの場合
←start関数が呼ばれるまでランナーを停止
←ランナーを再開
- 26. Mocha
■非同期
describe('async test', function(){
it('count exec', function(done){
myobj.tenTdsCount(function(count){
assert.equal(10000,count);
done();←doneが呼ばれるまで止まる
});
});
it(・・・)
});
hook系のメソッド(before,after,beforeEach,
afterEach)と組み合わせると、より細かい実行
制御もできる
■レポート形式
リポート形式はとても豊富で実行時に指定可
・Dot Matrix
・Spec
・TAP
・Landing Strip
・List
・Progress
・nyan