No Love from XCTest
No Love from XCTest
- Subject: No Love from XCTest
- From: P S <email@hidden>
- Date: Wed, 12 Feb 2014 13:17:07 -0500
Re: XCode 5.0.2, iOS 7
Folks,
I'm trying to make sense and use of the new XCTest functionality. We have thousands of SenTests, and I'm not ready to deal with the migration tool just yet. I'd like to start by building just a few tests using the new framework to see how it goes. Unfortunately, I'm getting nowhere fast. I've watched the WWDC 2013 video, and I've read over the "Unit Test Your App" documentation guide. Both seem to gloss over a lot of the details and assume that everything is just going to work if you click on the right buttons in the Xcode UI.
What I've been able to glean so far is that unit tests are based on a new target type that you can create using the standard Add Target... UI or by starting the same wizard from the Test Navigator UI by clicking on the + button. Once you've done that, it seems like Xcode starts creating cruft without asking you, and I've battled through this process once or twice, trying to get everything arranged the way I want. For example, I already have a UnitTests folder in my project, and I want to keep all unit test related files in this folder. I discovered that I needed to name my new target exactly "UnitTests" and then xcode would create its new files in the location I wanted.
So far, so good, or so I thought. Xcode also added a reference to the XCTest.framework, but I noticed the icon in the left pane was in red. The full path to the framework was invalid, but I was able to locate the proper path to the framework inside the Xcode app bundle and resolve that issue.
I next used the New File wizard to create a unit test. I added the file as a member of the UnitTests target. Everything looked good in the navigator, and so I clicked to run one of my tests. The test is very simply:
- (void)testSuccess
{
XCTAssertTrue(YES, @"We did it!");
}
Xcode builds and launches the simulator, and I see our app's splash screen appear briefly, and then the app in the simulator appears to just crash. No debugger window appears, there is no console output that I can find related to this crash, and I see nothing in the xcode UI indicating that any of the tests succeeded or failed or were even run. I've of course tried, building clean, cleaning the build folder, deleting all derived data from the organizer, quitting and restarting xcode, etc, etc. The results are always the same.
I figured maybe this was a result of some issues in our project configuration, so I decided to try using an Apple provided example project as my starting point. I chose the SimpleStocks project. I used only the GUI tools to add some unit tests (following the same steps that I saw on the video), and ran the auto generated SimpleStocks_Tests class and got the same results. Everything compiled, but the simulator launched, the stocks app appeared briefly, then seemed to crash, and no tests were run and no crash information was logged anywhere that I could see.
My first question is whether the simulator should even be launching. I didn't notice that happening when I watched the WWDC video. My second question is how do I figure out what's going wrong. If there is any additional documentation provided by Apple that goes into detail on testing, please point me in the right direction, and I will gladly go RTFM.
Thanks,
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden