v7.0.0 - AsyncSpec and Human-Readable Test Selectors #1217
younata
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Highlights
Async Test Changes
Quick 7 changes how Async tests are run. Instead of forcing all tests to run in an async context, Quick 7 provides a separate Spec class for Async Tests. Create an
AsyncSpecsubclass, and all tests inside of that subclass will run in an async context. Tests inside ofQuickSpecsubclasses will have a similar behavior to what was in Quick 5.Additionally, Quick 7 changes how the DSL is defined slightly. In Quick 6 and before, the DSL was defined as a series of global functions, available to be called anywhere. In Quick 7, these functions were moved to be static methods on the new
SyncDSLUser(whichQuickSpec,Behavior, andQuickConfigurationconform to) andAsyncDSLUser(whichAsyncSpecandAsyncBehaviorconform to) protocols. This allows us to make sure that you are using the correct DSL for the context, and was necessary for this approach.For example:
Unencoded Test Selectors
Furthermore, Quick 7 changes how test selectors are generated for
QuickSpec. Now, bothAsyncSpecandQuickSpecwill use the unencoded test names as the test selectors. Test selectors are now generated by joining thedescribe/contextblocks leading up to theitblock with ", ". This makes test names immensely easier to read. For example, with the following spec:will generate the following test selectors:
some feature, in one case, has a behaviorsome feature, in another case, doesn't have the earlier behaviorYou can disable this change by setting the
QUICK_USE_ENCODED_TEST_SELECTOR_NAMESenvironment variable.Migrating Suggestions
Quick 7 is not a drop-in migration from either Quick 5 or Quick 6. Quick 5 users will have a slightly easier time upgrading, but due to
specbeing defined as a class method instead of an instance method, there will still be changes.Doing a Find & Replace of
override func specwithoverride class func specwill take care of the low-hanging fruit. If you have any test helpers that exist as properties or methods of your QuickSpec subclasses, the you will need to either move them inside of thespecfunction, or outside to another scope. For Objective-C users, this is, for the most part, a drop-in replacement. You will only need to do anything if you do not use theQuickSpecBeginandQuickSpecEndmacros (in which case: do a find & replace of the regex-(\s*)\(void\)(\s*)specwith+$1(void)$2spec).For migrating from Quick 6 to Quick 7, it would be easiest to also do a Find & Replace of
: QuickSpecto: AsyncSpec, then migrate tests that do not need to run in async contexts to beQuickSpecs themselves.Auto-Generated Changelog
What's Changed
New Contributors
Full Changelog: v6.1.0...v7.0.0
This discussion was created from the release v7.0.0 - AsyncSpec and Human-Readable Test Selectors.
Beta Was this translation helpful? Give feedback.
All reactions