-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift Assertions in Xcode 9.1 #478
Comments
Seeing the same issue seems to be Xcode 9.1 specific. |
This is happening only when the test suite is run in the host application. For standalone tests everything works OK. |
You can continue the tests by clicking on "Continue program execution" but this gets tedious if you have a few of these type of tests. |
As a sort-of workaround for getting stuck on debugger breakpoints for fatal errors when running tests, you can run your tests without debugging support. Disable 'Debug Executable' in your scheme by going to Edit Scheme > Test > Info and unchecking 'Debug Executable'. |
@msewell Thanks for the tip. I just confirmed it and turning off "Debug Executable" stops this from happening. I guess if we need to actually have the debugger up for a test, we'll probably want to isolate using |
Many thanks for the feedback and useful suggestions! |
Maybe, you should mention this in documentation? Solution was not obvious for me. |
@MortyMerr: Disabling debugging during test runs isn't really a solution (it hardly even is a workaround). This issue still needs a "real" fix. |
A side effect of disable debugging during tests (which is quite inconvenient as is), is that it seems to affect coverage reports (always reports 0% when debug executable is disabled). |
Haven't had this issue before, until I started using Xcode 9.3 / Swift 4.1, where it fails consistently. Can confirm that disabling debugging during tests works, but as mentioned before, it's not a suitable workaround. |
Woops. And I am finding this issue as well, after having upgraded to Xcode 9.3.
Code to test executes the following assert:
In Xcode 9.2, the test pass fine. In Xcode 9.3, the line actually asserts and the test run fails because it detects an assertion (which it's actually supposed to detect). |
Hitting this with 9.3 as well. It appears from my testing that Apple has modified the way the debugger handles program exits and is aggressively halting at the point where the code exits. Thus making it impossible for Nimble to trap it. Turning off debugging of the executable does indeed halt the problem but is not really a solution as it effectively disables test debugging. I'm not sure that this can be addressed either with Nimble or XCTest functionality. |
Hello. Just wanted to know if there is an update about this? I'm having the same problem. Worked in XCode 9.2 but not in XCode 9.3. |
Problem is persisting in Xcode 9.4. I suspect this will not be fixed and Nimble will have to find an alternative solution. For myself, I've gone with the approach of using a local override of |
Looks like we can adopt mattgallagher/CwlPreconditionTesting@ce96cb1 to address the issue. Related to swiftlang/swift#11329. |
Fixed by #545. |
What did you do?
I used
expect { () -> Void in fatalError() }.to(throwAssertion())
in a test, whichthrows a fatal error, completely stops the tests suite execution, and we get a
test failed message
What did you expect to happen?
expect { () -> Void in fatalError() }.to(throwAssertion())
to succeed.What actually happened instead?
expect { () -> Void in fatalError() }.to(throwAssertion())
fails.Environment
List the software versions you're using:
Please also mention which package manager you used and its version. Delete the
other package managers in this list:
Maybe I'm missing something or doing something wrong, my deep apologies if that's the case.
Thanks for any feedback!
The text was updated successfully, but these errors were encountered: