我正在使用試用版webide並試圖從/ test-resources文件夾運行myqunittest.qunit.html。通過使用url /test-resources/myqunittest.qunit.html。但是,只要我嘗試運行它,它就會返回一個404錯誤。嘗試運行qunit測試時獲取404
這是定義資源的問題嗎?我不明白如何,可以找到view/Main.view.xml,但不是在測試資源文件夾中的任何東西(我試過只是創建一個簡單的JS或HTML文件包含一個單一的行,它仍然404 「D)。
我已經從qunit幫助頁面QUnit Testing Fundamentals直接複製了該頁面,這段代碼似乎意味着它應該只是在沒有任何其他應用的情況下工作。
我試過sap.ui.localResources和data-sap-ui-resourcesroots在這兩個html文件中的各種組合都無濟於事。
我的文件夾結構如下:
myapp
test-resources
myqunittest.qunit.html
view
Main.controller.js
Main.view.xml
index.html
myqunittest.qunit.html
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script id="sap-ui-bootstrap"
type="text/javascript"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-noConflict="true">
</script>
<link rel="stylesheet" href="resources/sap/ui/thirdparty/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="resources/sap/ui/thirdparty/qunit.js"></script>
<script type="text/javascript" src="resources/sap/ui/qunit/qunit-junit.js"></script>
<script type="text/javascript" src="resources/sap/ui/qunit/QUnitUtils.js"></script>
</head>
<body>
<div id="qunit"></div>
</body>
</html>
的index.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.m"
data-sap-ui-resourceroots='{"myapp": "./"}'
data-sap-ui-theme="sap_bluecrystal">
</script>
<script>
sap.ui.localResources("view");
var app = new sap.m.App({initialPage:"idMain"});
var page = sap.ui.view({id:"idMain", viewName:"myapp.view.Main", type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);
app.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
而不是刪除這個條目,你可以簡單地將你自己的測試資源重命名爲任何其他名稱,如「測試」,它再次完美無瑕。因此,請不要改動neo-app.json,只需更改測試的目錄名稱即可。 –