我已经设置了 siesta lite 来测试我的 ExtJs 4 应用程序。我想根据我的应用程序的 window.xxx 和 window.yyy 的值运行测试。所以如果 xxx= 1 和 yyy= 'xyz',我想运行一个特定的测试文件,比如说 test1.js。我阅读了午睡文档,但找不到任何东西。
这是我的代码:
var harness = new Siesta.Harness.Browser.ExtJS()
window.harnessObj = harness;
harness.configure({
title : 'My Tests',
preload : [
/* '../resources/extjs-4.2/resources/css/ext-all.css',
'../resources/extjs-4.2/ext-all-debug.js',
'../resources/json/textLabels.js',*/
]
});
harness.start(
{
group: 'Unit Tests',
pageUrl: '../index.html?unittest',
items:
[
{
title : 'PopUpWindow',
url : 'tests/PopUpWindow.js'
},
{
title : 'S_0-R_PjM',
url : 'tests/S_0-R_PjM.js'
}
]
}
);
harness.on('testsuitestart', function (event, harness)
{
//debugger;
console.log('I fucking love Testing')
}, this,
{ single : true }
)
我想根据我的应用程序 index.html 设置的 windows 对象的特定值在“tests/S_0-R_PjM.js”中运行“tests/S_0-R_PjM.js”。
我的 index.js 看起来像这样: // 也支持: startTest(function(t) {
describe(function(t) {
t.diag("PfalzkomApp Loading Test");
t.ok(Ext, 'ExtJS has been loaded');
t.ok(Ext.Window, 'ExtJS.Window has been loaded');
t.ok(window.xxx, loaded with value :' + window.xxx);
t.ok(window.yyy, loaded with value :' + window.yyy);
var status = parseInt(window.xxx);
var role = window.yyy;
switch(status) {
case 111:
switch(role)
{
case "abc":
debugger;
// How to load another test file(tests/S_0-R_PjM.js) and start that test here !!!
break;
case "def":
break;
}
}
t.done();
})
// 更新的问题 - 我想放在另一个测试文件中并在需要时调用它的示例代码
StartTest(function(t) {
t.diag("Case: Status: Neu and Role:PjM ");
//S_0-R_PjM
t.ok(Ext, 'ExtJS has been loaded');
t.done(); // Optional, marks the correct exit point from the test
})
有人可以指导我吗?