Can't run UI Testing on older project
Asked Answered
S

6

6

I'm trying to add and run UI Automation tests with Xcode 7 on an older project. Here's what I did:

  1. Added a new UI Testing target
  2. Changed the compiler version of that target to Default compiler (Apple LLVM 7.0)
  3. Recorded a test using the iPhone 6 Plus iOS9 simulator (worked like a charm)

Now, when I try to run the recorded test I get the following error:

failed: caught "NSInternalInconsistencyException", "No target application path specified via test configuration: testBundleURL:file:///xxxxxxxxxxx/PlugIns/PageonceUITests.xctest/ productModuleName:(null) testsToSkip:(null) testsToRun:(null) reportResultsToIDE:no sessionIdentifier:<__NSConcreteUUID 0x7fc818d181a0> 7045B650-CDAF-4EC9-9738-83F78E1514D8 pathToXcodeReportingSocket:(null) disablePerformanceMetrics:no treatMissingBaselinesAsFailures:no baselineFileURL:(null) targetApplicationPath:(null) targetApplicationBundleID:(null)

Statis answered 20/9, 2015 at 9:57 Comment(0)
B
2

This error seems to be complaining about "Target to be tested" field selected while adding UI Test Target.Does your "Target Application" property under UI Test Target -> General tab correctly shows your main app selected? A happy config would look like this,

2015-10-04 17:30:50.960 XCTRunner[22941:4703128] Found configuration <XCTestConfiguration: 0x7fbf3050c8b0>

testBundleURL:file:///Users/username/Library/Developer/Xcode/DerivedData/App-fxeyzrynjcscxzaxjvmnormcjhbr/Build/Products/Debug-iphonesimulator/APPUITests-Runner.app/PlugIns/APPUITests.xctest/
              productModuleName:APPUITests
                    testsToSkip:(null)
                     testsToRun:(null)
             reportResultsToIDE:YES
              sessionIdentifier:<__NSConcreteUUID 0x7fbf30503430> B324DF9D-769F-4217-901F-24482A719005
     pathToXcodeReportingSocket:(null)
      disablePerformanceMetrics:no
treatMissingBaselinesAsFailures:no
                baselineFileURL:(null)
          targetApplicationPath:/Users/username/Library/Developer/Xcode/DerivedData/APP-fxeyzrynjcscxzaxjvmnormcjhbr/Build/Products/Debug-iphonesimulator/AppName.app
      targetApplicationBundleID:com.bundle.appBundle.app.dev
               reportActivities:no
Biweekly answered 4/10, 2015 at 14:34 Comment(1)
I had the very same issue and this solved it.Itagaki
H
2

Its might be due to some issue with your Target settings.

Try the following.

  1. Delete the existing target .
  2. Create a new Target by selecting "iOS UI Testing bundle" again.
  3. Then link your test files one by one.

It works.

Haruspex answered 9/5, 2017 at 8:38 Comment(0)
E
0

I had the same issue and solved it by not using a Legacy build location as described in this answer: https://mcmap.net/q/386321/-nsinternalinconsistencyexception-when-running-uitesting-with-xcode-7

If I use "Legacy", UI tests can be recorded, but fail when I try to run them. Using "Unique" as setting and they work fine. (this can be reproduced with a new project)

Xcode → Preferences → Locations → Derived Data → Advanced... → [x] Unique

Epizootic answered 4/2, 2016 at 9:32 Comment(0)
P
0

I had the same problem on a physical iPad. When I finally deleted the app and all of its data and then shut down and rebooted the device the problem was resolved.

Prismoid answered 22/7, 2016 at 11:12 Comment(0)
L
0

You must add in your UITest target, in the relative "Build Settings" section, a custom "User-Defined settings" property:

enter image description here

with the keys:

TEST_TARGET_NAME : YourTargetName
USES_XCTRUNNER: YES (optional)

Now you're able to run your UI Tests.

Lifeblood answered 20/8, 2019 at 10:38 Comment(0)
S
0

This happens when you have the UI test files in the unit test target, make sure the file is in the correct target.

Shelba answered 30/12, 2021 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.