OPA5 是动化的针对 SAPUI5 和 OpenUI5 应用程序和组件的测试框架,它基于由 JQuery 开发人员开发的测试开源测试框架 QUnit。 OPA5 附带一个基于 sinon.js 的工具内置模拟服务器。 唯一支持的动化的传输格式是 OData。 如果后端使用 JSON 主体,测试则无法使用内置的工具模拟服务器。 大多数测试可以描述为没有后端服务的动化的集成测试。 OPA5 的云服务器提供商测试较新组件功能将用于测试,而不是工具在 IFrame 中运行。 如果出现错误,动化的这将允许更快的测试执行和更好的调试。 本文标题 JavaScript 文件的工具完整地址: https://sapui5.hana.ondemand.com/resources/sap/ui/qunit/qunit-redirect.js 位于命名空间 sap/ui/qunit 之下。 SAP UI5 SDK 网站上,并没有使用这个 redirect 文件。 本地实验,发现了一个不一致的地方: 这个 HTML 页面有三个 script 标签。 但是 elements 标签页里只能观察到一个: 脚本执行,当然是以 elements 里看到的为准: 解决这个问题的办法,是重启 ui5 serve: 重启了甚至关掉了 Chrome 的 tab,网站模板cache 依然存在: 为什么 head 后面两个 script 标签页识别不到?? 运行时: 调整一下位置,把 redirect 放在第一个标签页: 三个标签页没有一个能够匹配正则表达式: 需要把 2 去掉: 但是一旦重定向成功了,就无法调试了: 所以将其保存成一个本地文件: 改成本地文件后,很多 SAP UI5 标准的文件加载不了。 如果改成本地文件,b 的值为 “”: 然后 window.location 的值就为 test-resources/sap/ui/qunit/testrunner.html?testpage="+encodeURIComponent(T)+"&autostart=true"+(t?"&test-timeout="+encodeURIComponent(t):"");: 这个界面是从哪里来的? 本地 server 上没有,显然是 SAP UI5 服务器端的: http://localhost:8080/webapp/test/test-resources/sap/ui/qunit/testrunner.html?testpage=%2Fwebapp%2Ftest%2Ftestsuite.qunit.html&autostart=true http://localhost:8080/webapp/test/resources/sap/ui/thirdparty/es6-promise.js - 这个文件找不到 https://sapui5.hana.ondemand.com/test-resources jquery 的路径:https://sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/jquery.js blanket 的路径: https://sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/blanket.js https://sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/Handlebars.jshttps://sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/handlebars.js当我换成完整路径后: 没有 es6-promise.js 的加载了? 改成本地路径,这个奇怪的文件加载又回来了: 还是本地路径加载时,这个诡异的 testrunner.html: ../../../../resources/sap/ui/thirdparty/es6-promise.js https://sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/es6-promise.js 完整路径下的 testrunner.html, 有细微差别: 完整路径:https://sapui5.hana.ondemand.com/test-resources/sap/ui/qunit/testrunner.html