v7.0.0-beta.3
Pre-releaseBeta 3 Changes
Quick 7 Beta 3 adds a flag to re-enable the encoded test selector names. This is useful for automated test analysis tools which track tests over time or are broken with the new human-readable test selectors.
Set the QUICK_USE_ENCODED_TEST_SELECTOR_NAMES
environment variable and Quick will generate the older-style encoded test selector names (all non alpha-numeric characters will be replaced with underscores).
Thanks to @tikitu and @stonko1994 for their help prioritizing adding this flag.
As with previous betas, we encourage you to check this out, and to share feedback by filing an issue or discussing this in the discussion page.
Beta 2 Changes
Quick 7 Beta 2 changes how test selectors are generated for QuickSpec
. Now, both AsyncSpec
and QuickSpec
will use the unencoded test names as the test selectors. Test selectors are now generated by joining the describe
/context
blocks leading up to the it
block with ", ". This makes test names immensely easier to read. For example, with the following spec:
class MySpec: QuickSpec {
override class func spec() {
describe("some feature") {
context("in one case") {
it("has a behavior") {}
}
context("in another case") {
it("doesn't have the earlier behavior") {}
}
}
}
}
will generate the following test selectors:
some feature, in one case, has a behavior
some feature, in another case, doesn't have the earlier behavior
Beta 1 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 AsyncSpec
subclass, and all tests inside of that subclass will run in an async context. Tests inside of QuickSpec
subclasses 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
(which QuickSpec
, Behavior
, and QuickConfiguration
conform to) and AsyncDSLUser
(which AsyncSpec
and AsyncBehavior
conform 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:
class SynchronousSpec: QuickSpec {
override class func spec() {
it("runs synchronously, as you'd expect") {
var ocean: [String] = []
DispatchQueue.main.async {
ocean.append("dolphins")
ocean.append("whales")
}
expect(ocean).toEventually(contain("dolphins", "whales"))
}
}
}
class AsynchronousSpec: AsyncSpec {
override class func spec() {
it("runs the test in an async context") {
var ocean: [String] = []
DispatchQueue.main.async {
ocean.append("dolphins")
ocean.append("whales")
}
await expect(ocean).toEventually(contain("dolphins", "whales"))
}
}
}
Doing a Find & Replace of override func spec
with override class func spec
will take care of this. If you have any test helpers that exist on properties of your QuickSpec subclasses, the you will need to either move them inside of the spec
function, 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 the QuickSpecBegin
and QuickSpecEnd
macros (in which case: do a find & replace of the regex -(\s*)\(void\)(\s*)spec
with +$1(void)$2spec
).
For migrating from Quick 6 to Quick 7, it would be easiest to also do a Find & Replace of : QuickSpec
to : AsyncSpec
, then migrate tests that do not need to run in async contexts to be QuickSpec
s themselves.
We encourage you to check this out, and to share feedback by filing an issue or discussing this in the discussions.
Auto-Generated Changelog
Beta 3 Changes
- Add mechanism to fallback to legacy test selector names by @younata in #1211
- Don't imply that we plan to remove the option to force encoded test selector names by @younata in #1212
Beta 2 Changes
- Bump git from 1.12.0 to 1.13.0 by @dependabot in #1191
- Bump activesupport from 6.1.5 to 6.1.7.1 by @dependabot in #1196
- Bump danger from 9.1.0 to 9.2.0 by @dependabot in #1198
- Bump cocoapods from 1.11.3 to 1.12.0 by @dependabot in #1201
- Bump activesupport from 7.0.4.2 to 7.0.4.3 by @dependabot in #1203
- Bump fkirc/skip-duplicate-actions from 5.2.0 to 5.3.0 by @dependabot in #1188
- [Translation] AsyncAwait.md Korean translation by @tisohjung in #1204
- Update Nimble to v12 by @younata in #1206
- Demangle QuickSpec test names as much as possible by @younata in #1207
New Contributors
- @tisohjung made their first contribution in #1204
Full Changelog: v7.0.0-beta.2...v7.0.0-beta.3