概述
//begin Register a callback to fire whenever the test suite begins.
QUnit.begin( function ( details ) {
console.log( "Test amount:", details.totalTests );
} );
//done Register a callback to fire whenever the test suite ends.
QUnit.done( function ( details ) {
console.log( "Total: ", details.total, " Failed: ", details.failed, " Passed: ", details.passed, " Runtime: ", details.runtime );
} );
//log Register a callback to fire whenever an assertion completes.
QUnit.log( function ( details ) {
if ( details.result ) {
return;
}
var loc = details.module + ": " + details.name + ": ",
output = "FAILED: " + loc + ( details.message ? details.message + ", " : "" );
if ( details.actual ) {
output += "expected: " + details.expected + ", actual: " + details.actual;
}
if ( details.source ) {
output += ", " + details.source;
}
console.log( output );
} );
//moduleStart Register a callback to fire whenever a module begins.
QUnit.moduleStart( function ( details ) {
console.log( "Now running: ", details.name );
} );
//moduleDone Register a callback to fire whenever a module ends.
QUnit.moduleDone( function ( details ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total );
} );
//testStart Register a callback to fire whenever a test begins.
QUnit.testStart( function ( details ) {
console.log( "Now running: ", details.module, details.name );
} );
//testDone Register a callback to fire whenever a test ends.
QUnit.testDone( function ( details ) {
console.log( "Finished running: ", details.module, details.name, "Failed/total: ", details.failed, details.total, details.duration );
} );
//endregion
最后
以上就是坚强项链为你收集整理的单元测试文档 软件单元描述,QUnit单元测试文档的全部内容,希望文章能够帮你解决单元测试文档 软件单元描述,QUnit单元测试文档所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复