使用Xcode 7运行UITesting时出现“NSInternalInconsistencyException” [英] ‘NSInternalInconsistencyException’ when running UITesting with Xcode 7

查看:648
本文介绍了使用Xcode 7运行UITesting时出现“NSInternalInconsistencyException”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,到目前为止,我还没能在任何测试版中运行此测试。我遇到的一些问题是

  • UI测试下的swift文件已导入XCTest并且是XCTestCase的子类。

  • setup()启动应用程序
    XCUIApplication()。launch()

  • 我添加了以下内容(点击Record按钮) )

  • 然后,我运行了此测试。



    在调用测试之前,整个事情都失败了,在使用以下



    < blockquote>

    ***断言失败 - [XCUIApplication init],/ Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-8170.3/XCTestFramework/UI Testing / XCUIApplication.m:76
    /Users/UserName/Documents/Projects/Testing/UiTesting/UITestingApp/UITestingApp.swift:0:错误: - [UITestingApp.UITestingApp testSimpleTap]:失败:捕获NSInternalInconsistencyException,没有通过测试指定目标应用程序路径配置:

    testBundleURL:file:/// Users / UserName / Library / Developer / CoreSimulator / Devices / E3201DC2-CAD3-48C3-95F5-15E18DCA1836 / data / Containers / Bundle / Application / 8B33FC59-FC03- 41F8-BD21-43D81BA2D355 / UITestingApp-Runner.app / PlugIns / UITestingApp.xctest /

    productModuleName:(null)
    testsToSkip:(null)
    testsToRun :( null)
    reportResultsToIDE:no
    sessionIdentifier:< __ NSConcreteUUID 0x7f93e146c0b0> F242796B-ED26-4AA7-861A-540D2D93CB8F
    pathToXcodeReportingSocket:(null)
    disablePerformanceMetrics:no
    treatMissingBaselinesAsFailures :no
    baselineFileURL:(null)
    targetApplicationPath:(null)
    targetApplicationBundleID:(null)
    reportActivities:no


    任何人遇到此问题或对我可能遗失的内容有任何建议?



    注意:我确实设置了目标应用程序我的应用程序的UI测试目标



    更新:我注意到这适用于Xcode的所有beta / final版本 - 相应地更新了标题

    解决方案

    经过无休止的调整后,将Xcode首选项中的派生数据位置从Legacy更改为Custom并获得它工作!




    Ok, I’ve not been able to run this test in any betas so far. Some of the issues I’ve encountered are here and here

    Now, I feel like I’m missing something.

    Here’s my progress so far

    1. Enabled "UI testing" option while creating a new project. This, in fact adds a target for me. So I should be good to go - or so I thought.
    2. The swift file under UI Testing had already "XCTest" imported and was a subclass of "XCTestCase".
    3. setup() launches the application XCUIApplication().launch()
    4. And I added the following (by hitting the Record button)

    And then, I ran this test.

    The whole thing fails even before the test is called, right after launching app in setup() with the following

    *** Assertion failure in -[XCUIApplication init], /Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-8170.3/XCTestFramework/UI Testing/XCUIApplication.m:76 /Users/UserName/Documents/Projects/Testing/UiTesting/UITestingApp/UITestingApp.swift:0: error: -[UITestingApp.UITestingApp testSimpleTap] : failed: caught "NSInternalInconsistencyException", "No target application path specified via test configuration:
    testBundleURL:file:///Users/UserName/Library/Developer/CoreSimulator/Devices/E3201DC2-CAD3-48C3-95F5-15E18DCA1836/data/Containers/Bundle/Application/8B33FC59-FC03-41F8-BD21-43D81BA2D355/UITestingApp-Runner.app/PlugIns/UITestingApp.xctest/
    productModuleName:(null) testsToSkip:(null) testsToRun:(null) reportResultsToIDE:no sessionIdentifier:<__NSConcreteUUID 0x7f93e146c0b0> F242796B-ED26-4AA7-861A-540D2D93CB8F pathToXcodeReportingSocket:(null) disablePerformanceMetrics:no treatMissingBaselinesAsFailures:no baselineFileURL:(null) targetApplicationPath:(null) targetApplicationBundleID:(null) reportActivities:no

    Anyone run into this or has any suggestions on what I might be missing?

    Note: I did set the "Target Application" of the UI Testing target to my app

    Update: I noticed this is applicable to all beta/final releases of Xcode - updated title accordingly

    解决方案

    After endless tweaking, changed the Location of Derived Data in "Xcode Preferences" from "Legacy" to "Custom" and got it to work!

    这篇关于使用Xcode 7运行UITesting时出现“NSInternalInconsistencyException”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆