标签: xcode-ui-testing

不能在Xcode 7 UI测试目标中包含Objective-C .framework吗?

我试图依靠OHHTTPStubs作为一个框架,来自Xcode 7中的Swift UI测试目标.

我构建了.framework(通过Carthage,但我不确定它是否相关?)并将其拖入UI测试目标的Build Phases选项卡下的"带库的链接二进制文件"部分.

但是当我尝试@import OHHTTPStubs在我的.swift测试用例中时,Xcode告诉我No such module 'OHHTTPStubs'.

这应该很简单,我错过了什么?这是Github上的项目.

ios ios-frameworks carthage xcode7 xcode-ui-testing

6
推荐指数
0
解决办法
955
查看次数

如何在XCode7 iOS9中断言TextView值?

我正在进行UI单元测试.在图片里.
它们是UILabel,除了长描述是UITextView.
在我想要做的页面断言测试答案中的值.

对于UILabels的答案很好.我可以按照Xcode UI测试示例
这个方法非常容易理解,只需点击元素并将方法更改.tap().exist()然后将其括起来assert();

我的问题UITextView比复杂得多UILabel.
我怎样才能获得UITextView断言检查的价值?

func testG(){

let app = XCUIApplication()
app.launch();
app.buttons["Enter"].tap()
app.tables.staticTexts["Bee"].tap()

assert(app.scrollViews.staticTexts["Name :"].exists);
assert(app.scrollViews.staticTexts["Age :"].exists);
assert(app.scrollViews.staticTexts["Specialty :"].exists);
assert(app.scrollViews.staticTexts["Description :"].exists);

assert(app.scrollViews.staticTexts["Bee"].exists);
assert(app.scrollViews.staticTexts["11"].exists);
assert(app.scrollViews.staticTexts["Sky Diver"].exists);
let text = "Bees are flying insects closely related to wasps and ants, known for their role in pollination and, in the case of the best-known bee species, the European honey bee, for producing honey and beeswax. Bees …
Run Code Online (Sandbox Code Playgroud)

xcode unit-testing ios swift xcode-ui-testing

6
推荐指数
1
解决办法
1841
查看次数

如何在运行Xcode UI测试时禁用自动完成?

作为我的UI测试的一部分,我正在生成一个随机字符串作为我的对象的标题.问题是,当通过键盘(使用XCUIElement.typeText())输入此标题时,iOS有时会接受自动建议的值.

例如,我可能希望它键入一个自动生成的"calg"字符串,但自动更正将改为选择"calf".当我稍后尝试使用断言查找此值时,它不存在并且未正确地失败.

有没有办法告诉UI测试他们不应该使用自动更正,或者是否有我可以使用的变通方法?

xcode ios xcode-ui-testing

6
推荐指数
2
解决办法
1517
查看次数

使用UI测试测试操作扩展

是否可以对Action Extension目标执行UI测试?我无法使用Action Extension作为"要测试的目标"来创建UI测试目标.我试图从Safari(或照片中)加载动作扩展,尽管Safari /两者都是首选

如果我记录我的互动,我可以得到:

app.icons["Safari"].tap()

然后我可以手动添加:

XCUIDevice.sharedDevice().pressButton(.Home)

在生成的代码之前,但它没有按预期工作(模拟器留在主屏幕上).

我也尝试过:

UIApplication.sharedApplication().openURL(NSURL(string: "https://google.com")!)

但那也没有打开Safari.

我甚至不确定如果它能够启动,我是否能够与Action Extension自动交互,但希望它是可能的.

ios xcode-ui-testing

6
推荐指数
1
解决办法
1633
查看次数

Xcode ui test:staticTexts以

我想检查一下我的ui上以前缀开头的元素是否存在.如何在Xcode 7 UI测试中实现它?

app.tables["AAA"].staticTexts["Fax: 0049XXXXXXXX"].exists
Run Code Online (Sandbox Code Playgroud)

我有三个元素进入tableview单元格,只有一个元素(第三个或最后一个)以前缀Fax:0049开头.如何查看此元素的当前内容?

我试过了

app.tables["AAA"].cells.staticTexts.elementBoundByIndex(2).exists
Run Code Online (Sandbox Code Playgroud)

但没什么,有些想法?干杯

xcode ios swift xcode-ui-testing

6
推荐指数
1
解决办法
3476
查看次数

UITest的简单XCTest一直都在失败?

我从File - > New - > project开始一个新项目

我向ViewController添加了一个按钮.

我打开默认由xcode创建的UITest文件夹.运行测试代码.

它失败:

2016-03-16 12:57:09.191 XCTRunner[3511:150419] Continuing to run tests in the background with task ID 1
    t =    10.18s         Assertion Failure: UI Testing Failure - Failed to background test runner.
/Users/Bernard/Desktop/ExampleTestApplication/ExampleTestApplicationUITests/test2.m:27: error: -[test2 testExample] : UI Testing Failure - Failed to background test runner.
2016-03-16 12:57:12.789 XCTRunner[3511:150419] *** Terminating app due to uncaught exception '_XCTestCaseInterruptionException', reason: 'Interrupting test'
Run Code Online (Sandbox Code Playgroud)

现在我添加一个断点如下:

在此输入图像描述

现在测试成功了!任何人都可以解释原因吗?

xcode objective-c ios xctest xcode-ui-testing

6
推荐指数
1
解决办法
2088
查看次数

在ios UITest中间歇性"尝试启动失败"

我在Xcode7.3/iOS9.3上进行了UI测试,大约看了1/10

Test Case '-[WhatevUITests.RegistrationUITests testVerifyUnsupportedPhoneNumberAlert]' started.
    t =     0.00s     Start Test
    t =     0.00s     Set Up
    t =     0.01s         Launch me.jackpine.whatev-dev
    t =     0.11s             Terminate <XCUIApplicationProcess: 0x7ff91a712550 me.jackpine.whatev-dev (94280)>
    t =     1.14s             Assertion Failure: UI Testing Failure - Failure attempting to launch <XCUIApplicationImpl: 0x7ff91a49fae0 me.jackpine.whatev-dev at /Users/mkirk/src/jackpine/Whatev-iOS/build/Whatev/Build/Products/Debug-iphonesimulator/Whatev Dev.app>, nil token for current process reference <XCUIApplicationProcess: 0x7ff91a624440 me.jackpine.whatev-dev (94333)>
/Users/mkirk/src/jackpine/Whatev-iOS/WhatevUITests/RegistrationUITests.swift:16: error: -[WhatevUITests.RegistrationUITests testVerifyUnsupportedPhoneNumberAlert] : UI Testing Failure - Failure attempting to launch <XCUIApplicationImpl: 0x7ff91a49fae0 me.jackpine.whatev-dev at /Users/mkirk/src/jackpine/Whatev-iOS/build/Whatev/Build/Products/Debug-iphonesimulator/Whatev Dev.app>, nil token for …
Run Code Online (Sandbox Code Playgroud)

ios xcode-ui-testing

6
推荐指数
1
解决办法
949
查看次数

XCode UI测试:无法找到包含测试包路径的测试运行器应用程序

我在专用目标上编写了XCode 7.3.1中的UI测试.我可以录制UI测试,但如果我尝试启动它(所有测试或单个测试),我收到以下错误:

无法找到包含测试包路径的测试运行器应用程序/Users/dle/Library/Developer/Xcode/DerivedData/Keecoach-exynmciqyehgmxcfxhkpksrqifsb/Build/Products/Debug-iphonesimulator/DemoKeecoachUITests-Runner.app/PlugIns/DemoKeecoachUITests.app

XCode中的错误

我真的不明白这个消息,只是看起来跑步者应用程序必须启动测试并且跑步者应用程序不存在.这DemoKeecoachUITests-Runner.app实际上并不存在于我的磁盘上.

我找不到任何其他人在任何地方提到这个问题...如果我在命令行中启动测试,我会得到相同的错误xctool.我在其他计算机上遇到同样的问题,但我没有其他项目的问题,所以它与项目有关.任何线索?

xcode ios xcode-ui-testing

6
推荐指数
1
解决办法
1062
查看次数

我可以并行运行多个iOS UI测试吗?

我正在为我的iOS应用程序构建UI测试套件.我需要在几个不同的设备上测试我的应用程序的功能,但是现在我必须选择我想要的模拟器,运行测试,然后重复.

现在Xcode支持多个并行运行的模拟器,有没有办法同时在多个不同的设备模拟器上运行UI测试?

xcode ui-testing ios ios-simulator xcode-ui-testing

6
推荐指数
1
解决办法
1108
查看次数

Is it possible to open a screen directly in XCUITest?

I have 3 screens, lets say,

  1. Login
  2. Forgot Password
  3. Help screen

默认情况下,启动应用程序时将打开“登录”屏幕。单击“忘记密码”按钮时,将显示“忘记密码”屏幕,并且在单击“帮助”链接时将打开“帮助”屏幕。

我可以通过某种方式直接打开“忘记密码”屏幕,而无需执行使用XCUITest单击按钮的过程吗?

我建议与通过adb直接打开View的意图相同的内容。

testing swift xcode-ui-testing xcuitest

6
推荐指数
1
解决办法
1824
查看次数