0

enter code here因为我无法使用 4.6 版本的 Instruments 使通过/失败日志记录正常工作,所以我正在尝试使用tuneup.js库,但每当我尝试运行测试时,我都会收到以下错误:

Can't find variable: test

这是代码:

//We want to use the tuneup library to add extra capabilities
#import <tuneup_js/tuneup.js>
#import <tuneup_js/test.js>

var target = UIATarget.localTarget();

var target = UIATarget.localTarget();
var app = UIATarget.localTarget().frontMostApp();

test("Test1", function(target, app) {

//Do UI automation stuff

var titleDisplayed = tableView.cells()[0].name();
var StoryName = "My Dogs!";

UIALogger.logMessage("My Story Title: " + titleDisplayed);
UIALogger.logMessage("Innocuous Message-1.");


assertEquals(titleDisplayed, StoryName); 

}); // <------Error points to this line!

//End test

知道我做错了什么吗?tuneup.js 库位于名为 tuneup_js 的文件夹中,该文件夹位于包含我的测试脚本(仪器跟踪文件)的目录的根目录中,并且在启动时我没有收到任何导入错误。

4

1 回答 1

1

问题是 Instruments 找不到 *tuneup_js* 库,所以它找不到测试函数。您需要在引号中添加导入,并且不需要添加tuneup_js/test.js,因为tuneup_js/tuneup.js包含所有需要的类

//We want to use the tuneup library to add extra capabilities
#import "tuneup_js/tuneup.js"


var target = UIATarget.localTarget();

var target = UIATarget.localTarget();
var app = UIATarget.localTarget().frontMostApp();

test("Test1", function(target, app) {

//Do UI automation stuff

var titleDisplayed = tableView.cells()[0].name();
var StoryName = "My Dogs!";

UIALogger.logMessage("My Story Title: " + titleDisplayed);
UIALogger.logMessage("Innocuous Message-1.");


assertEquals(titleDisplayed, StoryName); 

});
于 2013-03-11T07:28:05.447 回答