Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Xcode用户界面测试:staticText';文本更新时s标签不更新?_Ios_Automation_Xcode Ui Testing - Fatal编程技术网

Ios Xcode用户界面测试:staticText';文本更新时s标签不更新?

Ios Xcode用户界面测试:staticText';文本更新时s标签不更新?,ios,automation,xcode-ui-testing,Ios,Automation,Xcode Ui Testing,背景 我正在研究将基于Appium的自动化迁移到Xcode UI测试。鉴于我们的应用程序是用Objective C编写的,我也需要将Objective-C用于测试代码 我正在为其自动测试的应用程序有一个进度条,我想读取它的值。它不是一个,只是一个UIAStaticText,其值从“0”增加到“100%” 与此静态文本对应的xguielement可通过以下方式访问: [[app staticTexts] elementBoundByIndex:1] 进度条将花费不同的时间-我需要监控进度,这将涉

背景

我正在研究将基于Appium的自动化迁移到Xcode UI测试。鉴于我们的应用程序是用Objective C编写的,我也需要将Objective-C用于测试代码

我正在为其自动测试的应用程序有一个进度条,我想读取它的值。它不是一个,只是一个
UIAStaticText
,其值从“0”增加到“100%”

与此静态文本对应的
xguielement
可通过以下方式访问:

[[app staticTexts] elementBoundByIndex:1]
进度条将花费不同的时间-我需要监控进度,这将涉及读取值(当然还有解析值)

我尝试使用各种方法获取值-
[xguielement-value]
[xguielement-label]

NSString *prog = [[[app staticTexts] elementBoundByIndex:1] label];
label
方法是获取进度字符串,因此我在循环中执行此操作,例如

  int i=0;
  while (i<5) {
     //custom sleep method
     [self.helper threadSleepForSeconds:[NSNumber numberWithInt:2]];
     //now get progress text
     NSString *prog = [[[app staticTexts] elementBoundByIndex:1] label];

     i++;
    }

我很不明白为什么会发生这种情况。有什么帮助吗

没有合成事件,因此Xcode不会尝试在屏幕上拍摄UI元素的新快照。这是经过设计的,以便在特定视图中分配多个ui元素变量不会使您的计算机工作过度

不幸的是,如果您对单元测试不满意,手动测试可能是您唯一的选择

19%
19%
19%
19%