Ext.JS 4.2.1使用Jasmine进行单元测试-未定义应用程序
Ext.JS 4.2.1 UnitTesting using Jasmine - Application Not defined
我正在尝试为类似于Sencha Docs的控制器设置一些单元测试。
我还试图在我的规范类之上定义我的视图和控制器:
describe("User Administration Testing", function () {
var view = new MR.view.administration.User({ renderTo: Ext.getBody() }),
ctrl = new MR.controller.administration.User();
我在Ext.onReady(…)处理程序中的app-test.js中创建了应用程序,如下所示:
Ext.onReady(function () {
Application = Ext.application({
name: 'MR',
extend: 'MR.Application',
autoCreateViewport: true,
launch: function () {
this.callParent();
//include the tests in the test.html head
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
jasmine.getEnv().execute();
}
});
});
我的run-tests.html看起来是这样的:
<html>
<head>
<title id="page-title">Tester</title>
<link rel="stylesheet" type="text/css" href="app-test/lib/jasmine-1.3.1/jasmine.css">
<script type="text/javascript" src="ext/ext-debug.js"></script>
<script src="bootstrap.js"></script>
...
<!-- test launcher -->
<script type="text/javascript" src="app-test.js"></script>
<script type="text/javascript" src="app-test/lib/jasmine-1.3.1/jasmine.js"></script>
<script type="text/javascript" src="app-test/lib/jasmine-1.3.1/jasmine-html.js"></script>
<!-- include specs here -->
<script type="text/javascript" src="app-test/specs/GlobalSpec.js"></script>
<script type="text/javascript" src="app-test/specs/Administration/UserSpec.js"></script>
</head>
<body>
</body>
</html>
问题是,我的spec类总是在我的app-test.js文件中的Ext.onReady函数之前执行。。。因此,例如,我的MR.view没有被定义。
请帮忙。
describe("User Administration Testing", function () {
var view = null, ctrl = null;
beforeEach(function () {
if(!view) view = Application.getView("User");
if(!ctrl) ctrl = Application.getController("User");
});
相关文章:
- AngularJS指令单元测试中未定义的函数
- AngluarJS单元测试-未定义不是函数
- 因果报应单元测试'未定义'不是函数错误
- 未定义的Es6级在单元测试中与大口摩卡
- 如何进行单元测试以查看角度是否未定义
- 当使用 Jasmine 对我的 angularJS 应用程序进行单元测试时,$interval是未定义的
- 在 Javascript 中测试未定义的嵌套对象
- Asp.net:Microsoft JScript 运行时错误:“测试”未定义
- 使用 === 运算符测试未定义而不是使用 == 运算符有什么好处
- 类型错误:parsed 在 angularjs 服务单元测试中未定义
- Angular2单元测试Http MockBackend问题-无法读取mergeOptions中未定义的属性合并
- 无法读取属性'0'的未定义(仅在单元测试中)
- Ext.JS 4.2.1使用Jasmine进行单元测试-未定义应用程序
- 美元的范围.单元测试期间控制器中未定义的$on
- 未定义不是函数:单元测试护照身份验证自定义回调
- Jasmine单元测试未在travis上启动
- 使用“var undefined”来测试未定义有什么问题吗?
- 在 Javascript 中测试未定义的函数
- 誓言JS测试未定义
- 使用Karma - done()运行的Mocha单元测试没有定义