OCUnit tests do not work, but Xcode Log Navigator says "No problem"

I have a very difficult problem in Xcode and its "Log Navigator".

I recreated such a question; I have a very simple OCUnit test:

-(void)testSimpleFailure{ STFail(@"Please fail!"); } 

I clean my build, build my test circuit and run my tests.

In the output console window, I see all my test executions, including the ones above. The console displays the actual test run. And failed:

 ##teamcity[testFailed name='-|[SimpleTestClassTests.testSimpleFailure|]' message='Please fail!' details=''] 

HOWEVER, Xcode displays “Successful Overlay Tests” and “Log Navigator” on the left says that there are no problems, and all are green.

Has anyone else had a similar problem? Does anyone know how to solve this?

I would very much like for me not to receive a false positive before committing.

Edited to clarify my question.

+6
source share
6 answers

I run my test applications and unit tests on the device. I get the same results as you - the tests fail, but Log Navigator says that everything passes. Not only that, I cannot set breakpoints in my code.

The solution for me was “Edit Schema ...”, selected the “Test” scheme and changed my debugger from “LLDB” to “GDB”. I am using Xcode 4.3.2, with my compiler installed for all purposes in LLVM 3.1

After changing my debugger for the testing scheme on GDB, Log Navigator reports testing errors, and I can set breakpoints and debug also during the tests.

link: search for “test module failure before executing any code” (LLDB error) https://github.com/kstenerud/iOS-Universal-Framework

+11
source

Well, after about 3 developers reviewed this problem for 5 days, we found a solution:

 rm -rf Library/Application\ Support/iPhone\ Simulator 

Or, alternatively, if you drop an entire directory tree, this is not your thing:

Go to the iOS Simulator app. Select iOS Simulator from the top menu and select "Reset Content and Settings ..."

Something seems to be getting corrupted between the simulator and Xcode, so Xcode cannot connect to the simulator to view the tests. Xcode believes that there were no tests, so the tests pass.

We are not sure what causes this, but after 5 exhausting days and 1 decision later, we do not care, because we are heading to the nearest bar.

Greetings.

+7
source

I just read this long post about a problem that also affects Mac apps:

http://masonmark.com/the-xcode-fairy/

The trick seems to be to exit Xcode and reopen the project. The error is intermittent and will sometimes be here or never will be, and it will remain in this state until the next Xcode restart.

It is also well read.

+2
source

Yes, I saw it, intermittent and annoying.

Make sure the first (last) log message is selected.

0
source

What worked for me: Reset Simulator, as Nick L mentioned in his PLUS answer closes Xcode and reboots. Then every build using STAssertTrue (false) or STFail will give me a negative result.

0
source

If you use XCTest, make sure that you deploy the iOS 7 simulator. If you upgrade to iOS 6, it will say that the build is successful, the test fails, but does not provide any information about registering in the debugger.

0
source

Source: https://habr.com/ru/post/903459/


All Articles