-
-
Notifications
You must be signed in to change notification settings - Fork 910
Fix empty 'Selected tests' suites #901
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
Conversation
Generated by 🚫 Danger |
c86cf20
to
c74bc8d
Compare
This is a failing test for Quick#891
When `Selected tests` suite is executed, XCTest doesn't call `defaultTestSuite`. The examples are now built lazily when needed.
c74bc8d
to
a1da480
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for fixing this! 👍
It seems that by this fix, a crash occurs when using focused tests 😕
|
This crash looks familiar. Let me double check again. it’s been a while :) |
[QuickConfiguration class]; | ||
World *world = [World sharedWorld]; | ||
|
||
NSArray *examples = [world examplesForSpecClass:[self class]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be rootExampleGroupForSpecClass
. When in focued tests, the return value for a class whose examples are not focused entirely is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'll open a new PR with the fix shortly.
@ikesyo What's your way to reproduce the crash? I can't replicate it. |
The crash happens when a shared example is registered in a unfocused spec class. In that case, Quick/Sources/QuickObjectiveC/QuickSpec.m Lines 94 to 111 in da6761d
Quick/Sources/Quick/World.swift Lines 236 to 240 in d3f39da
This case was not covered in QuickFocusedTests unfortunately. 😭 |
So adding |
Cool, thank you! I'll put the test for it + the fix into a new PR. Thanks for your help @ikesyo. |
This is a failing test for the crash reported here: Quick#901 (comment)
This commit fixes the crash reported in Quick#901 (comment)
This commit fixes the crash reported in Quick#901 (comment)
This PR fixes the regression introduced in a3ece4f. Closes #891
The
defaultTestSuite
method wasn't called when the 'Selected tests' type of test suite was executed. This caused thespec
method not being invoked and the examples for the given class were never built.This PR changes the behaviour and introduces a new
buildExamplesIfNeeded
method. This method can be called safely multiple times. We call it from both thedefaultTestSuite
andtestInvocations
methods. This ensures the examples are built properly no matter which method is called (or in which order).Checklist - While not every PR needs it, new features should consider this list: