Extjs Jasmine 2.3和Ext JS 5.0.1
我正在尝试用Jasmine 2.3.4测试ExtJS5.0.1应用程序。我不断收到错误“UncaughtReferenceError:Descripte未定义”。这就好像它没有看到描述、It和其他全局功能一样。如果我将Jasmine文件切换到1.3,那么它确实可以看到这些全局函数。我想使用最新版本的Jasmine,而且,我不确定1.3是否能很好地与ExtJS5配合使用。还有其他人遇到过这个问题吗?下面是代码片段: specrunner.jspExtjs Jasmine 2.3和Ext JS 5.0.1,extjs,jasmine,Extjs,Jasmine,我正在尝试用Jasmine 2.3.4测试ExtJS5.0.1应用程序。我不断收到错误“UncaughtReferenceError:Descripte未定义”。这就好像它没有看到描述、It和其他全局功能一样。如果我将Jasmine文件切换到1.3,那么它确实可以看到这些全局函数。我想使用最新版本的Jasmine,而且,我不确定1.3是否能很好地与ExtJS5配合使用。还有其他人遇到过这个问题吗?下面是代码片段: specrunner.jsp <!DOCTYPE HTML PUBL
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Application</title>
<!--Jasmine Files -->
<link rel="stylesheet" type="text/css" href="/app_name/app/js/jasmine/jasmine.css">
<script type="text/javascript" src="/app_name/app/js/jasmine/jasmine.js"></script>
<script type="text/javascript" src="/app_name/app/js/jasmine/jasmine-html.js"></script>
<!-- ExtJS Files -->
<script type="text/javascript" src="//cdn-tst.corporate.com/LNF/4/4.0.1/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="//cdn-tst.corporate.com/LNF/4/4.0.1/extjs/packages/ext-theme-classic/build/ext-theme-classic.js"></script>
<!-- Jasmine Test Case File -->
<script type="text/javascript" src="/app_name/app/js/spec/AppSpec.js"></script>
<!-- app Test Case File -->
<script type="text/javascript" src="/app_name/app/js/test/app.js"></script>
</head>
<body>
</body>
</html>
AppSpec.js
describe ("ExtJS App Test Suite", function () {
debugger;
beforeEach (function () {
// Initializing the mainPanel
debugger;
tripsStore = Ext.StoreManager.lookup ('Trips');
simpleTrip = Ext.create ('app.view.simpleTrip');
controller = Ext.create ('view.controller.tripController');
});
/* Test if View is created Successfully.*/
it ('View is loaded', function () {
debugger;
expect (simpleTrip != null).toBeTruthy ();
});
/* Test if store is loaded successfully.*/
it ('Store shouldn’t be null', function () {
debugger;
expect (tripsStore != null).toBeTruthy();
});
/* Test controller is initialized successfully.*/
it ('Controller shouldn’t be null', function () {
debugger;
expect (controller != null).toBeTruthy();
});
});
如果您对descripe和其他功能不可见的原因有任何建议,我们将不胜感激 描述,它。。。jasmine.js中不再定义Ext,而是在jasmine库附带的boot.js中定义。如果从页面中删除Ext,会发生什么?还是同一个问题吗?在经历了大量的头痛之后,我发现1.3的文件比2.3的少。就这么简单。我更新了specrunner.jsp,使其包含boot.js和jasmine_favicon.png,并运行了它。谢谢PomPom。当从1.3移动到2.3.x时,包含boot.js,我在上面的启动函数中的代码不再是必需的。
describe ("ExtJS App Test Suite", function () {
debugger;
beforeEach (function () {
// Initializing the mainPanel
debugger;
tripsStore = Ext.StoreManager.lookup ('Trips');
simpleTrip = Ext.create ('app.view.simpleTrip');
controller = Ext.create ('view.controller.tripController');
});
/* Test if View is created Successfully.*/
it ('View is loaded', function () {
debugger;
expect (simpleTrip != null).toBeTruthy ();
});
/* Test if store is loaded successfully.*/
it ('Store shouldn’t be null', function () {
debugger;
expect (tripsStore != null).toBeTruthy();
});
/* Test controller is initialized successfully.*/
it ('Controller shouldn’t be null', function () {
debugger;
expect (controller != null).toBeTruthy();
});
});