在上一篇中出现了一个问题,就是用 jsunit2.2alpha11.zip 包进行测试时,在firefox、safari 上不能进行测试,无法访问本地系统文件,经过在网上查找,发现了解决问题的办法,解决的原文如下:
2009年9月23日
|
|
|
Tried having a bash with jsUnit today, and got instantly stuck when trying to run a basic test case. FireFox simply hung, and I really had no idea why. For the first time, IE8 worked fine! Thanks to this post, it was straightforward enough to get working. First you have to modify the jsUnitTestManager.js file, and replace/insert the following code: function isFF3() {
return (
navigator.userAgent.toLowerCase().indexOf("iceweasel/3") != -1 ||
navigator.userAgent.toLowerCase().indexOf("firefox/3") != -1
)
}
function browserSupportsReadingFullPathFromFileField() {
return !isOpera() && !isIE7() && !isFF3();
//return !isOpera() && !isIE7();
}
Secondly, you'll have to disable the draconian security that new FF introduces. Type about:config in your address bar and then set security.fileuri.strict_origin_policy to false. This will allow FireFox to access local resources without a problem. Now it will have disabled the browse to field, so the only way you can run your tests is directly via the address bar, as so: <path to testrunner.html>?testpage=<path to mytests.html>
|
|
|
大概意思是:
首先,你必须修改jsUnitTestManager.js文件,并替换/插入下面的代码
function browserSupportsReadingFullPathFromFileField() {
return !isOpera() && !isIE7() && !isFF3();
//return !isOpera() && !isIE7();
}
function isFF3() {
return (
navigator.userAgent.toLowerCase().indexOf("iceweasel/3") != -1 ||
navigator.userAgent.toLowerCase().indexOf("firefox/3") != -1
)
}
其次,修改firefox的配置,打开ff3,在地址栏输入about:config,搜索security.fileuri.strict_origin_policy,双击就可修改,如下图:
修改完成后,我们重新来运行的测试
注:上面不是用jsunit的插件运行的,如果用插件运行的话,又报以下错误,唉~现还不知道如何解决,忘高手指点。
以上这样改后,firefox3可以通过测,但发现 safari 还是通不过,于是干脆把以上脚本作如下修改:
function browserSupportsReadingFullPathFromFileField() {
return false;
//return !isOpera() && !isIE7() && !isFF3();
//return !isOpera() && !isIE7();
}
再测试时发现可以了:
但还是遗憾的是 jsunit 插件 在ff3 safari 运行不起来。先留在这里以后解决吧~!
- 大小: 15.5 KB
- 大小: 20.9 KB
- 大小: 24.6 KB
- 大小: 18.4 KB
分享到:
相关推荐
JsUnit是JavaScript的开源单元测试框架。它受到JUnit的启发,并完全用JavaScript编写。作为最流行的 JavaScript单元测试框架,它还提供了一些ant任务,使开发人员在持续集成服务器上构建时很容易运行测试套件。
javascript单元测试 jsunit2.2
前台单元测试材料,适合初学者对前台测试的了解和学习。
javascript单元测试,入门简介,简单应用(一般应用,Ajax,测试套件)
很好的JavaScript测试工具,呵呵,首次发表望多多支持.
jsunit2.2是一款很好的js测试工具
单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试技术讲解单元测试...
用于js代码的单元测试,类似于java中的JUnit单元测试框架,十分好使!
OpenHarmony自动化测试框架代码部件仓arkXtest,包含单元测试框架(JsUnit)和Ui测试框架(UiTest)。单元测试框架(JsUnit)提供单元测试用例执行能力,提供用例编写基础接口,生成对应报告,用于测试系统或应用接口。Ui...
NULL 博文链接:https://llying.iteye.com/blog/258605
单元测试工具JSUNIT,用于测试javascript,内含安装方法、使用说明、功能介绍以及个人心得等,较全面。
这是javascript页面的单元测试 类似于Junit但是稍有区别 用起来也很简单
支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)...
支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)...
支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)...
支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)...
支持的浏览器包括IE(7, 8, 9, 10, 11),Mozilla Firefox,Safari,Google Chrome,Opera等。selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)...
JsUnit 完全包和Eclipse对JsUnit支持插件
jsunit 教 程 ppt (英语)
JSunit入门教程.pdf