前端自动化测试工具doh学习总结(一)
作者:网络转载 发布时间:[ 2014/5/28 16:49:50 ] 推荐标签:自动化测试工具 doh
三、测试用例
doh为我们提供了以下断言函数:
|
doh.assertTrue(boolean)
Note: This function is aliased to doh.t();
doh.assertFalse(boolean)
Note: This function is aliased to doh.f();
doh.assertEqual(obj1, obj2)
Note: This function is aliased to doh.is();
doh.assertNotEqual(obj1, obj2)
Note: This function is aliased to doh.isNot();
|
Junit中,编写一个测试用例我们需要继承Junit类,同样在doh中也有自己的规则来将一段代码,包装成doh可识别的测试案例。
doh中主要提供了以下方法(常用的是doh.register):
|
doh.register(...)
An almost 'magical' function. The doh.register() method accepts the function signatures of any of the other registration functions and determines the correct underlying function (listed below) to dispatch registration to. It's the function you'll most commonly use for registering Unit Tests.
doh.registerTest(group, testFuncOrObj)
This function registers a test as a member of the group 'group', and the test can either be a simple function definition or a 'Test Fixture', which is an object that defines the run requirements of the test.
doh.registerTests(group, testFuncOrObjArr)
This function registers an array of tests as a member of the group 'group'. The contents of the array of tests can be an array of simple test functions or an array of 'test fixtures', or a mix of them.
doh.registerTestNs(group, obj)
This function registers an object comprised of functions as a member of the group 'group'. Note that this function will only add in non-private (functions without an _ at the beginning of the name), as a test function. If you'd like to use fixtures (setUp(), tearDown(), and runTest()), please use doh.register(), doh.registerTest() or doh.registerTests().
doh.registerTestUrl(url)
This function registers a URL as a location to load tests from. The URL is used to populate the contents of an iframe, and usually refers to an HTML page that boot-loads D.O.H. internally for running tests in a segmented iframe. A good example showing this is the dojo/tests/fx.html. It loads dojo, doh, and then on dojo load completion calls doh.registerTests(). The D.O.H. instance in the iframe will proxy back the results of the test run to the primary D.O.H. instance.
|
上面提到的dojo/test/fx模块中我们可以看到该文件中主要定义了两个TestSuite:
define(["doh/main", "require"], function(doh, require){
if(doh.isBrowser){
doh.register("tests.fx", require.toUrl("./fx.html"), 30000);
doh.register("tests.NodeList-fx", require.toUrl("./NodeList-fx.html"), 30000);
}
});
对应于runner.html中
.jpg)
打开该目录下的fx.html文件,我们可以看到该文件中定义了一系列TestCase

本文内容不用于商业目的,如涉及知识产权问题,请权利人联系SPASVO小编(021-61079698-8054),我们将立即处理,马上删除。
相关推荐
两种自动化测试工具AutoRunner与Selenium的对比自动化测试工具中的脚本回放报对象不存在如何解决?自动化测试工具中录制到不想要的对象该怎么办?QTP和AR两大自动化测试工具的对比常见的5个自动化测试工具对比分析浅谈自动化测试工具AutoRunner中对象库的重要性自动化测试工具AutoRunner常见问题及解决方法汇总app自动化测试工具MR的脚本调用自定义函数自动化测试工具AR对象库功能有什么意义?自动化测试工具AR测试过程中出现场景异常应该怎么办?如何使用自动化测试工具AR录制火狐浏览器和Edge浏览器脚本?AR自动化测试工具使用常见问题汇总及解决办法(五)AR自动化测试工具使用常见问题汇总及解决办法(四)浅谈自动化测工具的原理:3大主流自动化测试工具AR自动化测试工具使用常见问题汇总及解决办法(三)自动化测试工具AR进阶功能之如何修改对象权重

sales@spasvo.com