Make sure that the file exists and is a Test Page

Jsunit使用Firefox测试时,出现错误提示:

    Reading Test Page file:///e:/testJsunit/test1.html timed out.

    Make sure that the file exists and is a Test Page.

源码如下:

e:\testJsunit\test1.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
	  <title> New Document </title>
	  <meta name="Generator" content="EditPlus">
	  <meta name="Author" content="">
	  <meta name="Keywords" content="">
	  <meta name="Description" content="">

	  <script type="text/javascript" src="..\java-software\jsunit2_2\jsunit\app\jsUnitCore.js"></script>

	  <script type="text/javascript" src="test1.js"></script>

	  <script type="text/javascript">
		function testAdd(){
			
			var result = add(5,3);
			assertEquals(8,result);
		}
		function testSubstract(){
			
			var result = substract(5,3);
			assertEquals(2,result);
		}
	  
	  </script>
  <head>
	<body>
	</body>
<html>


e:\testJsunit\test1.js:

function add(num1,num2){
	return num1+num2;
}
function substract(num1,num2){
	return num1-num2;
}


jsUnitCore.js文件的路径为  e:\java-software\jsunit2_2\jsunit\app\jsUnitCore.js

以上源码及引入文件路径都是正确的,但就是报异常。解决方案如下:

  1. 在firefox的地址栏中输入:about:config,这时回车后可能会弹出

Make sure that the file exists and is a Test Page_第1张图片

点击I'll be careful,I promise!即可

2.在search输入框中输入fileuri,如下:

Make sure that the file exists and is a Test Page_第2张图片

3. 将security.fileuri.strict_origin_policy的值由true改为false(双击即变为false),如下:

Make sure that the file exists and is a Test Page_第3张图片

至些,再重复试下,jsunit测试则正常。

    这里要特别注意jsUnitCore.js的引入路径问题,如本例的路径改为

    src="..\jsunit2_2\jsunit\app\jsUnitCore.js",则一样报这个异常。

参考:https://connectedweb.wordpress.com/2012/03/07/fix-for-make-sure-that-the-file-exists-and-is-a-test-page-jsunit-firefox/

你可能感兴趣的:(Make sure that the file exists and is a Test Page)