Changelog
5.7.2 September 2023
Fixes
- Revert to build against JDK 1.8
- Removed autoscan warning
5.7.1 September 2023
Fixes
- Fix timeout detection when withTimeout wraps a blocking job (#3675)
- Use object equals by default (#3671)
5.7.0 September 2023
Improvements
- Refactor concurrency #3623
- Add support of Equality to all contain* matchers (#3662)
- Added shouldBeEqualUsingFields (#3652)
- Add nullable type support to test functions (#3665)
- Compose Matcher.any (#3664)
- Make Matcher.all multiplatform (#3663)
- Allow nested jar scanning by configuration (#3644)
- Bind BlockHoundMode setting to coroutines, lifting restrictions (#3622)
- Add sequence version of monotonic/strictly inc/dec (#3645)
- Added reworked non-deterministic functions (#3597)
- Added warning for autoscan #3640
- Add expect block to skip tests (#3596)
- Add includeNonFiniteEdgeCases flag for double and float arbitrary (#3638)
- Arb.offsetDateTime based on Instant (#3632)
- Reimplement
KProperty0<T>.shouldHaveValueas matcher (#3637) - Add more java.time supports for reflective bind (#3636)
- Add KProperty0 assertions (#3621)
Arb.listimplementation supportingArb<IntRange>andArb.intRange(#3618)- Added config options for retry (#3600)
- implemented beforeInvocation and afterInvocation hooks (#3589)
- add
Arb<Date>support (#3554) - Adding support for partial permutations (#3523)
- add exhaustive enumsExcept (#3552)
Fixes
- Fix order of afterXX callbacks (#3639)
- Updated NaN handling in assertions (#3661)
- Only invoke beforeSpec if a test is invoked (#3649)
- Filter out success in matcher.all (#3646)
- Add allowOutOfOrderCallbacks (#3642)
- Updated docs for RgxGen #3607
- Added see-difference formatting for shouldHaveSingleElement (#3599)
- Use the default spec for the first test in InstancePerTest (#3601)
- Throw error if @Order is used without specifying spec execution order (#3641)
- feat: map matchers (all or exactly) allow dynamic matchers (#3569)
- extra properties are not tolerated with different array ordering (#3629)
- Rewrite System Extensions docs for more clarity (#3630)
- matchJsonResource should check file existence (#3634)
- Fix nullable reflective binds not working some supported types (#3635)
- Fix extension processing order, prioritize test case config (#3613) (#3614)
- Fix duration shrinker so it shrinks (#3611)
- Fix name of withDefaultTimeZone in docs (#3615)
- Undeprecating shouldEqualSpecifiedJson. #3543
- Correcting reporting of errors from BeforeSpec when using InstancePerTest spec (#3585)
- Rename Data Class Matchers to Composed Matchers (#3406)
- Fix outdated option in the jacoco documentation #3539
- Fixing TestAbortedException not being marked as Ignored (#3587)
- Removing workaround for using @Language for MPP (#3591)
- Feature/improve arrow documentation (#3570)
- Add fix to handle scenario where no tags are present in the runtime tags, but some specs are annotated with @RequiresTag() (#3532)
- Making NamedTag a data class, so it gets equals() (#3579)
- Adding indices of elements in inspectors failure messages (#3578)
- Fix CollectingTestEngineListener retaining all the Specs (#3573)
- fmap matchers allow null value (#3568)
- fix IrLinkageError with K/Js on Kotlin 1.9 (#3557)
- fix annotation typo and add link to Spring docs (#3551)
- Bugfix/add char to platformstable types (#3536)
- updating lib name from 'Test containers' to 'Testcontainers' (#3545)
- Fixing test that was broken after previous commit
- Fix documented annotation as
@RequireTagswhich should be@RequiresTag(#3530) - fix reflective bind failing on sealed class with object member (#3529)
- Adding changelog for v5.6.2 (#3519)
Thank you to all contributors since the 5.6.0 release
- AJ Alt
- Alexey Yakovlev
- Alphonse Bendt
- aSemy
- Ayushi Gupta
- Charles Korn
- Claudenir Freitas
- Cory Thomas
- David Weber
- Dmitry Spikhalskiy
- Emil Kantis
- Erik Huizinga
- hughlunnon
- Israel José Boiko
- Just.Viktor
- Karl-Philipp Richter
- ktrueda
- Leonardo Colman Lopes
- Łukasz Pięta
- Łukasz Wasylkowski
- Matej Drobnič
- Mikael Elm
- Mitchell Yuwono
- OliverO2
- Paolo Simonazzi
- Rafał Prominski
- SEONGILKIM
- sksamuel
- Thom
- Viktors Garkavijs
- Vladislav Krasov
- Zak Henry
5.6.2 May 2023
Assertions
- Adding shouldHaveSameInstantAs matcher for OffsetDateTime. Fixes #3488 by @Kantis in https://github.com/kotest/kotest/pull/3501
Property testing
- Fixes a problem with property testing on Apple platforms #3506
- Reverts behaviour of
Arb.string()to only generate Strings of printable ascii characters- 5.6.0 changed it to include some control characters, see #3513 for details
- Fix huge allocation for OffsetDateTime Arb without arguments by @rescribet in https://github.com/kotest/kotest/pull/3491
- Fix Arb.map edgecases by @myuwono in https://github.com/kotest/kotest/pull/3496
Documentation
- Update writing_tests.md by @erikhuizinga in https://github.com/kotest/kotest/pull/3497
- Update shouldBeEqualToComparingFields doc by @ktrueda in https://github.com/kotest/kotest/pull/3416
Other
- Build Kotlin/Native library for ARM64 on Linux by @charleskorn in https://github.com/kotest/kotest/pull/3521
⚠️ Reverted behavior of Arb.string()
With Kotest 5.6.0, Codepoint.ascii() was changed to include a wider range of ascii chararacters, and Codepoint.printableAscii() was introduced with the historic range used by Codepoint.ascii().
Arb.string() has been using Codepoint.ascii() as it's default for generating chars for the string. This caused issues for some users, and we decided to revert Arb.string() to the historic behavior by changing the default to the new Codepoint.printableAscii().
Hopefully this doesn't cause any issues for you. If it does, you can revert to the 5.6.0 ~ 5.6.1 behavior by using Codepoint.ascii() explicitly.
If you added explicit usage of Codepoint.printableAscii() to circumvent the issue, you can safely remove the explicit parameter starting with Kotest 5.6.2.
New Contributors
- @rescribet made their first contribution in https://github.com/kotest/kotest/pull/3491
- @ktrueda made their first contribution in https://github.com/kotest/kotest/pull/3416
- @erikhuizinga made their first contribution in https://github.com/kotest/kotest/pull/3497
Full Changelog: https://github.com/kotest/kotest/compare/v5.6.1...v5.6.2
5.6.1 April 2023
** This release is mainly to add some missing klib dependencies for ios **
Improvements
- add language annotation to json matchers (#3487)
5.6.0 April 2023
** Note this release bumps the minimum required version of Kotlin to 1.8.0. ** ** If you are using < 1.8.0 you can continue to use Kotest 5.5.x **
Breaking changes:
- Moved
ConstantNow-related functions to a new module namedio.kotest:kotest-extensions-now(remember to add -jvm suffix for Maven)- Add this module as a dependency to keep using
withConstantNow
- Add this module as a dependency to keep using
- Remove Iterable checking logic from IterableEq (#3420)
Fixes
- BlockHound extension: Fix handling of nested tests (#3454) (#3456)
- fix(JunitXmlReporter): resolve paths with irrelevant directories correctly (#3479)
- Fix
Codepoint.ascii()to return arbitrary printable ASCII characters (#3429) - Fixing BOM publication to include -jvm artifacts. Fixes #3417
- Re-implement language injection annotation (#3397)
- Support UUID, Path, file as stable identifier on JVM (#3472)
Improvements
- Upgrade to Kotlin 1.8 (#3468)
- Adding generators for upper/lower casing strings (#3402)
- expose random seed in property context (#3469)
- Printing type when failing numeric or default comparison (#3395)
- Add access to background scope via extension (#3315)
- 'assertSoftly' and 'all' imply clue (#3425)
- enhance Json assertions reuseability (#3438)
- Add shouldContainAllIgnoringFields (#3394)
- Expose discovered specs as TestDescriptors during discovery and add support for unique IDs (#3461)
- Support superclass annotations when deciding whether a class should be isolated. (#3441)
- Deprecate older json matchers (#3474)
- Move constant now to new module; bump junit to 1.8.2 (#3470)
- Added @RequiresPlatform (#3475)
- Added shouldBeEqual (#3477)
- Expose testCoroutineScheduler to mpp (#3471)
- Implement shouldThrowSoftly (#3476)
- Added Exhaustive for permutations of a list (#3473)
- shouldBe/shouldNotBe chain (#3186)
- Tags defined in spec should be applied before listeners (#3189)
- use GlobalArbResolver for reflective Arbs (#3455)
- property arb for duration (#3227)
- add edgecase 'emptyMap' to Arb.map() (#3447)
- Restoring old mocha/jasmine external test functions
- Remove concurrency mode from docs (#3434)
- Adding tvos sim / watchos sim snapshot deployments
- Increase max arity of checkall property tests to 22 (#3382)
- Support coroutineTestScope globally (#3383)
Thank you to all the contributors since the 5.5.0 release:
- Alex Decker
- Alexey Genus
- Alphonse Bendt
- Andrey Kozlov
- AnouarD
- Anouar Doukkali
- Arvind Arikatla
- aSemy
- Bartłomiej Zaręba
- eduardbosch-jt
- Emil Kantis
- Grégory Lureau
- Ivan “CLOVIS” Canet
- IvanPavlov1995
- Jama Mohamed
- Jean-Michel Fayard
- julian abiodun
- Julian K
- Leonardo Colman Lopes
- Łukasz Pięta
- Marc Philipp
- Martin Caslavsky
- Matej Drobnič
- Mitchell Yuwono
- OliverO2
- Osip Fatkullin
- ov7a
- Pankaj
- Ryan Lewis
- RyuNen344
- Sangboak Lee
- Sergey Volkov
- Shervinox
- sksamuel
- Stefanqn
- Travis
- Varun Arora
- Vinícius Hashimoto
- Vladimir Sitnikov
- Xavier Oliver
- Zak Henry
5.5.5 February 2023
- Support coroutineTestScope globally (#3383)
- Improved double and float tolerance messages (#3355)
- Nested Data Driven Tests is not displayed as nested in Intellij #3341
- Fixed writing seeds when test name contains a colon on windows (#3304)
- withClue() fails with EmptyStackException if a coroutine switches threads #2447
- Use TestDispatcher inside beforeInvocation callbacks (#3363)
- Make checkCoverage checking against provided pairs (#3344)
- Kotest runner junit5 jvm has vulnerable transative dependency CVE-2021-29425 #3364
- Fix sequence matchers for constrained sequences (#3336)
- Print full path in JunitXmlReporter when useTestPathAsName is enabled instead of just leaf and first parent #3347
- Support { } lambdas as lazy clues (#3348)
- Use 'language injection' on assertions, so embedded languages are easier to use in IntelliJ #2916
- Removing default location for htmlReporter and using the default value from the constructor (#3306)
- Arb.bigDecimal should generate decimals which terminate with all kinds of terminal digit #3282
- Check enums using equals method instead of scanning their properties (#3291)
- Add BlockHound support (#3308)
- Matchers return
this. (#2945) - Added shouldMatchResource, shouldNotMatchResource matchers (#2945)
- Added
matchExactlymatcher for Maps #3246 - Fix dumping config when systemProperty set to true (#3275)
- Returning the original failure when ErrorCollector has only collected a single failure (#3269)
5.5.4 November 2022
- Fixes an issue when combining gradle filters. (
ANDwas wrongly applied between filters, instead ofOR) (#3277)
5.5.3 October 2022
- Updated JUnit version from 5.7.2 to 5.8.2.
Kotest now requires the runtime version of JUnit to be at least 5.8.x
Note: If your build somehow manages to put both JUnit 5.7 and 5.8 onto the classpath and they load in the wrong order, you might see problems related to ClassOrderer not being found. Please make sure that only JUnit 5.8+ is loaded
5.5.2 October 2022
- Gradle test filter fixes, by @myuwono (#3257)
- Tag inheritance configuration is now available on AbstractProjectConfig
5.5.1 October 2022
- Fixed an issue where tests where being skipped when filtered out by the full spec name
5.5.0 October 2022
Fixes
- Fix issue using compiler plugin with Kotlin 1.7.20. (#3220)
- Allow registering global custom arbs through
GlobalArbResolver(#3185) - Fix data tests for all
BehaviorSpecscopes. (#3222) - Fix nullable maps in data tests (#3218)
- Detect project config after applying config from system properties (#3204)
- Support
enabledOrReasonIfin nestedFunSpec - Fix misleading error message when
Arb.ofis given an empty list (#3195) - Error if trying to use
afterEachcallback after test registration (#3191) - Attempt to improve the error message for
containExactlywhen used with non-stable sets (#3194) - Wrap InvalidPathException into an AssertionError when attempting to use invalid json path (#3147)
Improvements
- Added lazy mountable extensions (#3187)
- Support printing unsigned integers clearly (#3149)
- Added
shouldBeCloseTomatcher (#3181) - Added new regex matchers:
shouldMatch,shouldMatchAll,shouldMatchAny - Wildcard support in launcher (#3200)
- Support test coroutines on K/N (#3219)
- Add ability to toggle the inheritance of
@Tags(#3199) - Publish Gradle version catalog (#3171)
- Support prefix wildcards in gradle --test selectors (#3190)
- Better unique collection matchers (#3188)
- Add cartesian triples helpers for
Exhaustive(#3174) - use configurable property for Kotest compiler plugin version (#3168)
- Support printing unsigned integers clearly (#3149)
Thanks to all the contributors since the 5.4.0 release:
- Alex
- aSemy
- ataronet
- Charles Korn
- Emil Kantis
- Jaehyun Park
- James Baker
- Jinseong Hwang
- Kevin Woodland
- Leonardo Colman
- Michael Sewell
- Mitchell Yuwono
- Nikunj Yadav
- Prat
- Rasmus V. Plauborg
- sksamuel
- YongJoon Kim
5.4.2 August 2022
- Fix issues running tests for native targets on Kotlin 1.7+ (#3107)
shouldContainJsonKeyshould be true for keys with null values (#3128)
5.4.1 July 2022
Fixes
- Fix regression which causes
NoSuchMethodErrorwhen using the Kotest Spring extension
5.4.0 July 2022
Fixes
- Fix problem with isolation mode when duplicate names occur (#3071)
- Allow
Arb.bindto directly bind to sealed, enum and private types (#3072) - Fix
kotest.propertiesto apply before tests #3087 - Fix
shouldHaveSameContentAsdoesn't close the readers (#3091 - Fix tolerance matchers for negative values. (#3096)
- Adjust warning message to match enum value (#3067)
- Fix compilation failures for Kotlin/Native projects that use Kotlin 1.7 and the Kotest Gradle plugin. (#3073)
- Fix description of harryPotterCharacter arb (#2963)
Features
- Support persisting and reusing seeds for property tests #2967
shouldMatchAllhas been added to Maps where each value is a function containing assertions. #3065shouldBeEqualToComparingFieldsnow supports configuring classes which require the use ofshouldBefor equality, over regularequals- Add arbs for
ZoneId,ZonedDateTime, andOffsetDateTime(#3113) YearMonthArbitrary implementation (#2928)- Make
arb.orNullprovide a shrink to null (#2975) - Enable building native targets for kotest-assertions-json. (#3021)
- Json Array size validation (#2974)
- Add optional reason to
@Ignored(#3030) - Set runtime retention on dsl marker (#3038)
- Add shrinker for Sets (#3045)
Experimental features and changes
- Assumptions have been added to property testing.
- Statistics generation has been added to property testing.
- JSON schema array assertions now support
minItems,maxItemsanduniqueItems#3026 - (BREAKING) Altered the contract of JSON schema DSL to default to required properties,
requiredhas been changed tooptional, with false as default.
Deprecation
- Deprecated existing
shouldBeEqualToComparingFieldsin favor of a newshouldBeEqualToComparingFieldsmatcher which lets you configure the behaviour using aFieldsEqualityCheckConfigclass. (#3034)
Thanks to all contributors since the 5.3.0 release:
- Alphonse Bendt
- Andrey Bozhko
- aSemy
- Ashish Kumar Joy
- blzsaa
- Charles Korn
- Cory Thomas
- Emil Kantis
- Erik Price
- Francesco Feltrinelli
- Javier Segovia Córdoba
- Jim Schneidereit
- Jordi
- Norbert Nowak
- Roland Müller
- Shervinox
- sksamuel
- Tim van Heugten
- YongJoon Kim
- Zvika
5.3.2 June 2022
Fixes
- Fixes compiler plugin issue with Kotlin/Native using Kotlin 1.7, issue #3060
5.3.1 June 2022
Fixes
- Support for Kotlin 1.7
5.3.0 May 2022
Fixes
- Fail fast should nest to any level #2773
- Fix Repeating Container Descriptions Break the Execution #2884
- Fix JS code generation for 1.6.21 by using main (#2947)
- AbstractProjectConfig is missing displayFullTestPath #2941
Features
- Support gradle class method filters (#2954)
- Offer coroutines runTest mode (#2950)
- Added sortedBy matcher (#2944)
- Automatic binding of enums. Closes #2937
- Make it easier to configure options through environment variables by also supporting variable names with underscores instead of dots. (#2925)
- EndsWith and startsWith matcher support regex for (#2892)
Thanks to all the contributors since the 5.2.0 release:
- Ashish Kumar Joy
- Charles Korn
- coffee-and-tea
- dependabot[bot]
- Emil Kantis
- Goooler
- Imran Malic Settuba
- Jim Schneidereit
- Łukasz Pięta
- Marcin Zajączkowski
- Michał Gutowski
- Mitchell Yuwono
- Naveen
- Niklas Lochschmidt
- Norbert Nowak
- Rüdiger Schulz
- sksamuel
- Vitor Hugo Schwaab
5.2.3 April 2022
Fixes
- Update to fix error with kotlinx-coroutines 1.6.1 (#2912)
- Fixes haveElementAt Matcher throw ArrayIndexOutOfBoundsException (#2895)
5.2.2 March 2022
Fixes
- Adjust PIT gradle plugin configuration (#2903)
- implement trampolines for flatmap, map, filter, merge. (#2900)
- fix Arb.map to honor minSize parameter in both generation and shrinks (#2890)
- Made isOrderedSet platform-specific, to allow TreeSet eq. Fixes #2879
- Fix negativeFloat and positiveFloat edgecases (#2880) Mitchell Yuwono* 16 Mar 2022, 21:56 b40de793
- Fixes shouldBeEqualToComparingFields failure when nested field contains null (#2874)
Features
- Implement ShouldThrowWithMessage (#2847)
- Implement CharSequence Inspectors (#2886)
5.2.1 March 2022
Fixes
- Fixes a regression in 5.2.0 which introduced an error when trying to access root scope from test scope.
- Trying to define root tests during execution of nested tests now errors correctly. (2870)
5.2.0 March 2022
Fixes
AnnotationSpecdoes not support suspend @Before function (2868)- Fixed dependency scope for RgxGen in property tests (2800)
- BigDecimal arb could return edgecases outside min max limits (2834)
- Fix random spec sorter creating invalid comparator (2840)
- Fix
withClueandassertSoftlyinterference with concurrent coroutines (2791) - Fix handling the edge cases of lenient json number comparison (2793)
- Corrects group id for kotest assertion compiler module. (2787)
- Add workaround for issue where no tests are run when using new Kotlin/Native memory model. (2812)
Features and improvements
- Added
forSingleinspector andmatchEach,matchInOrderandmatchInOrderSubsetmatchers (2695) - Added
shouldBeJsonObjectandshouldBeJsonArraymatchers (2861) - Ignore JUnit UniqueId selectors for better interop with other engines (2862)
- Easily compose matchers together (2864)
- Make length of collection snippet included in assertion errors configurable (2836)
- Smart cast
shouldBeSuccessandshouldBeFailure(2853) - Remove inconsistent exceptionClass default values in eventually (2831)
- Makes
shouldBeEqualToComparingFieldsrecursive (2833) - Add
blockingTestto the config options on FreeSpec 2805 (2807) - Added EqualsVerifier contract for
shouldBeEqualTofor greater customization (2795) - Add
containExactlythat takes a vararg of pairs (2781) - Update Test Containers to support multiple init scripts (2811)
Breaking Changes
- Disallow use of root scope methods inside container scope (2870)
Thanks to all the contributors:
- Ashish Kumar Joy
- BjornvdLaan
- Charles Korn
- Christoph Sturm
- Emil Kantis
- Imran Malic Settuba
- Ing. Jan Kaláb
- inquiribus
- Kacper Lamparski
- KIDANI Akito
- Leonardo Colman
- Louis CAD
- Łukasz Pięta
- luozejiaqun
- Mervyn McCreight
- Mitchell Yuwono
- OliverO2
- scottdfedorov
- Sebastian Schuberth
- sksamuel
- Sondre Lefsaker
- Sunny Pelletier
- Zak Henry
5.1.0 January 2022
Fixes
- Test fails because lhs of shouldBe is List, and rhs is a home-grown Iterable #2746
- JUnit XML extension generates invalid XML #2756
- Non-nullability gets lost with shouldBeSuccess matcher #2759
- Arb.bind should detect nullables and inject null values #2774
Features and improvements
- Update coroutines to 1.6 final #2768
- Arb.string shrinking simplest character is always 'a' regardless of codepoint #2646
- Add mutable test clock #2655
- Inspectors for maps #2656
- Add conditional invert function with parameter to conditionally invert #2658
- Add project wide fail fast #2684
- Allow setting the seed used for randomizing spec order #2698
- Option to fail build if a seed is set on a property test #2701
- LocalDateTime arb should accept localdatetimes as min and max #2704
- System property to disable config scanning #2766
- System property for config class #2767
Thanks to all the contributors:
- aSemy
- Ashish Kumar Joy
- Bart van Helvert
- Benjamin Shults
- Charles Korn
- Emil Kantis
- Imran Settuba
- inquiribus
- Łukasz Pięta
- Max Rumpf
- Ricardo Veguilla
- Sebastian Schuberth
- Simon Vergauwen
- sksamuel
5.0.3 December 2021
Fixes
- ShouldContainExactlyTest fails on Windows because of path separators assertions bug #2732
- shouldBe goes into an infinite loop when generating diff message for data class with cyclic references #2611
- Issues when using globalAssertSoftly assertions bug framework #2706
- Fix issues in shouldStartWith and shouldEnd #2736
5.0.2 December 2021
Fixes
- Fixed erroneous timeout reporting in tests #2714
- Team City Listener should not be lazy for all tests #2707
- Fix Test path filter vs whitespace in test names #2725
- Support nulls in data driven testing #2718
- Fixes clue not working were expected or actual is null #2720
- Changed timeout defaults to use durations for clarity
- Fixed after/before container not being extensions #2721
- Share TestCoroutineDispatcher in nested tests #2703
- Fixes FunSpec contexts where tests are disabled #2710
- Return ComparableMatcherResult from json assertions #2620
- Remove @ExperimentalTime where Duration has gone stable #2708
- Remove Arb#long workaround for incorrect randomly generated values #2700
5.0.1 November 2021
Fixes
- Display names now include affixes when configured
- Fixed WordSpec to work with intellij plugin when used nested contexts
- Added testCoroutineDispatcher override to project config #2693
- Fixed compiler plugin multiplatform race condition #2687
- Regression: Test times reported as zero in junit #2686
- Dump coroutine debug output automatically after test finishes #2680
- JSON Matchers does not offer "Click to see difference"
4.6.4 November 2021
Fixes
- Fixes
ShouldContainExactlyfor collection containing byte arrays (#2360) - Fix InstantRange random nanos selection when the seconds equal the ends of the range (#2441)
- Fix endless recursion in 2-arity
checkAll(#2510) - Fix wrong index in forAll4 (#2533)
- Fixes
withEnvironmentempty system environment variables on Linux (#2615) - Change should to
shouldNotonshouldNotBeEqualToComparingFieldsExcept(#2637) - Remove accidentally nested Try (#2669)
5.0.0 November 2021
Kotlin 1.6 is now the minimum supported version
See detailed post about 5.0 features and changes here
Breaking Changes and removed deprecated methods
- Javascript support has been reworked to use the IR compiler. The legacy compiler is no longer supported. If you are running tests on JS legacy then you will need to continue using Kotest 4.6.x or test only IR.
Arb.valueshas been removed. This was deprecated in 4.3 in favour ofArb.sample. Any custom arbs that override this method should be updated. Any custom arbs that use the recommendedarbitrarybuilders are not affected. #2277- The Engine no longer logs config to the console during start by default. To enable, set the system property
kotest.framework.dump.configto true. #2276 TextContexthas been renamed toTestScope. This is the receiver type used in test lambdas. This change will only affect you if you have custom extension functions that useTestContext.- The experimental datatest functions added in 4.5 have moved to a new module
kotest-framework-datatestand they have been promoted to stable. equalJsonhas an added parameter to support the newshouldEqualSpecifiedJsonassertion- Changed
PostInstantiationExtensionto be suspendable ConstructorExtensionis now JVM only. Previously it was available on other targets but had no effect outside the JVM.- When using inspectors, the deprecated
kotlintest.assertions.output.maxsystem property has been removed. This was replaced withkotest.assertions.output.maxin 4.0. - The deprecated
isolationsetting in Specs has been removed. UseisolationMode. - Moved
assertionModefromTestCaseto test case config. - The deprecated
RuntimeTagExtensionhas been undeprecated but moved to a new package. - Removed deprecated
shouldReceiveWithinandshouldReceiveNoElementsWithinchannel matchers.
Fixes
Test Framework
- Support composed annotations plus caching of annotation lookups #2279
- Fix autoClose lazyness #2395
- Strip . from JS test names #2483
- Escape colons for team city output #2445
- Delete temporary directories recursively when using
tempdir#2227
Assertions
- String matchers now also work on CharSequence where applicable #2278
withEnvironmentfails with empty system environment variables on Linux #2615- Fixes ShouldContainExactly for collection containing byte arrays #2360
- 2412 Makes Sequence.containExactly work for single pass sequences #2413
- Fix withClue and assertSoftly for coroutines switching threads #2447
- Allow clues to be added to timeouts #2230
- Possible confusion between shouldContainExactlyInAnyOrder overloads #2587
- shouldBeEqualToComparingFields handles arrays and computed properties #2475
Property Testing
- Fix Arb.long/ulong producing values outside range #2330
- Fix Arb.localDate take into account the date/month portion of the specified minDate #2370
- updated FloatShrinker and DoubleShrinker to regard mantissa bit count as complexity measure #2379
- Bugfix/2380 arb filter shrinks #2434
- PropTestConfig's iterations parameter not being respected #2428
- Fix endless recursion in 2-arity checkAll #2510
- Fix wrong index in forAll4 #2533
- StackOverflow when using checkAll #2513
- fix Arb.uuid performance by caching RgxGen instances for reuse #2479
- Property Module: Mutation of global PropertyTesting fix for Kotlin/Native #2469
- Add BigDecimal edge case for equals vs compareTo discrepancy #2403
- Fix InstantRange random nanos selection when the seconds equal the ends of the range #2441
Features
Test Framework
- Javascript IR support has been added.
- Native test support has been added.
- Config option to enable coroutine debugging
- Config option to enable TestCoroutineDispatchers in tests.
- Failfast option added #2243
- Unfinished tests should error #2281
- Added option to fail test run if no tests were executed #2287
- Added
@RequiresTagfor improved spec exclude capability #1820 - Add fun interace to EnabledCondition #2343
- In Project Config,
beforeAll/afterAllare now deprecated andbeforeProject/afterProject, which are suspend functions, have been added #2333 projectContextis now available as an extension value inside a test lamba to provide access to the runtime state of the test engine.- Added standalone module that can be used by tool builders to launch Kotest #2416
kotest-framework-datatestmodule is now published for all targets- Framework now supports a project wide timeout #2273
- New ProjectExtension extension point has been added.
- Allow extensions to be registered via
@ApplyExtensionannotation #2551 - Add logging to test scopes #2443
- Added
DisplayNameFormatterExtensionextension point #2507 - Add configuration option to send full test name paths to junit 5 #2525
- Added support for @Nested in AnnotationSpec #2367
- Added system properties for filtering tests and specs #2547
- Should error when container tests do not contain a nested test #2383
Assertions
- Return the resulting value of the function block from
shouldCompleteWithin#2309 - Added
shouldEqualSpecifiedJsonto match a JSON structure on a subset of (specified) keys. #2298 shouldEqualJsonnow supports high-precision numbers #2458- Added
shouldHaveSameStructureAsto file matchers - Added
shouldHaveSameStructureAndContentAsto file matchers - Inspectors are now inline so can now contain suspendable functions #2657
String.shouldHaveLengthBetweenshould accept ranges #2643beOneOfassertion now tells you what the missing value was #2624- String matchers have been updated to work with any
CharSequence#2278 - Add
shouldThrowMessagematcher #2376 - Add Percentage tolerance matchers #2404
- Add NaN matchers to Float #2419
- Replaced eager matchers with lazy counterpart #2454
- Compare JSON literals in Strict mode #2464
- Added matchers for empty json #2543
- Added comparable matcher result and applied to
shouldContainExactly#2559 - Updated
iterables.shouldContainto return the receiver for chaining - Added aliases for inspectors #2578
- Inspectors should return the collection to allow chaining #2588
- Disable string diff in intellij #1999
CompareJsonOptionshas been added for more control when comparing json #2520- Support for ignoring unknown keys in JSON asserts #2303
- Add support for Linux ARM64 and macOS ARM64 (Silicon) targets. #2449
Property Testing
- Change usages of Char.toInt() to Char.code since Kotlin 1.5. Migrate codepoints to Codepoint companion object. #2283
- Generex has been replaced with Rgxgen #2323
- Improve Arb function naming #2310
- Improve Arb.primitive consistency #2299
- Add
Arb.intszero inclusive variants #2294 - Add unsigned types for Arb #2290
- Added arb for ip addresses V4 #2407
- Added arb for hexidecimal codepoints #2409
- Added continuation arbs builder that allow arbs to be used in a similar fashion to for comprehensions. #2494
- Added
Arb.zipas an alias forArb.bind#2644 - Add primitive arrays to Arb #2301
- improved geo location generator #2390
- Fix LocalDate arb generating wrong dates outside constraints #2405
- Add zip for Exhaustive #2415
- Add cartesian pairs helpers for Exhaustive #2415
- Add
Arb.distinctthat will terminate #2262 - Add arb for timezone #2421
- Added auto classifiers #2267
- Added arity8 and arity9 forall for table testing #2444
- Allow global seed configuration. Synchronize defaults. #2439
- Support complex data classes in
Arb.bind#2532 - Shrink when using
Arb.bind#2542 - Introduce constraints for property testing #2492
- Property testing should use bind as default for data class #2355
- Platform independent double shrinker #2517
Arb.pairshould returnArb<Pair<K, V>>#2563- Add support for Linux ARM64 and macOS ARM64 (Silicon) targets. #2449
Deprecations
CompareMode/CompareOrderforshouldEqualJsonhas been deprecated in favor ofcompareJsonOptions { }TestStatushas been deprecated andTestResultreworked to be an ADT. If you were pattern matching onTestResult.statusyou can now match on the result instance itself.val nameinsideListenerhas been deprecated. This was used so that multiple errors from multiple before/after spec callbacks could appear with customized unique names. The framework now takes care of making sure the names are unique so this val is no longer needed and is now ignored.SpecExtension.intercept(KClass)has been deprecated in favor ofSpecRefExtensionandSpecExtension.intercept(spec). The deprecated method had ambigious behavior when used with an IsolationMode that created multiple instances of a spec. The new methods have precise guarantees of when they will execute.- The global
configurationobject has been deprecated as the first step to removing this global var. To configure the project, the preferred method remains ProjectConfig, which is detected on all three platforms (JVM, JS and Native). SpecInstantiationListenerhas been deprecated in favour ofInstantiationListenerandInstantiationErrorListener, both of which support coroutines in the callbacks.SpecInstantiationListeneris a hold-over from before coroutines existed and will be removed in a future version.- The
listenersmethod to add listeners to a Spec has been deprecated. When adding listeners to specs directly, you should now preferfun extensions()rather thanfun listeners(). SpecIgnoredListner(note the typo) has been renamed toInactiveSpecListener.
Contributors
Thanks to all authors who contributed to this huge release. In alphabetical order (all commits since 4.6.0)
AJ Alt, Ali Khaleqi Yekta, Alphonse Bendt, Andrew Tasso, Ashish Kumar, Ashish Kumar Joy, Bart van Helvert, Charles Korn, Christoph Pickl, Cory Thomas, dave08, Derek Chen-Becker, dimsuz, Emil Kantis, Federico Aloi, Hugo Martins, IgorTs2004, Imran Settuba, Ing. Jan Kaláb, IvanPavlov1995, Javier Segovia Córdoba, Jean-Michel Fayard, Jerry Preissler, Jim Schneidereit, Leonardo Colman, Marcono1234, Marvin Sielenkemper, Mervyn McCreight, Michael Werner, Mikhail Pogorelov, Mitchell Yuwono, Nico Richard, niqdev, OliverO2, Rustam Musin, Scott Busche, Sebastian Schuberth, Simon Vergauwen, sksamuel, Srki Rakic, SuhyeonPark, Tobie Wee
4.6.3 September 2021
Fixes
- StackOverflow when using checkAll with certain arity functions #2513
- Added arity8 and arity9 forall for table testing #2444
4.6.2 August 2021
Fixes
- Reverted use of 1.5 API introduced erroneously in 4.6.1
- autoClose breaks lazy #2388
- minDate not respected in Arb.localDate #2369
- Sequence.containExactly should work for single pass sequences #2412
- BigDecimal edge case for equals vs compareTo discrepancy #2403
- PropTestConfig's iterations parameter is not respected. #2428
- tempfile and tempdir should fail test when deletion fails #2351
4.6.1 July 2021
Fixes
- HTMLReporter - css not loading (href of the file is absolute, not relative) #2342
- Annotations such as @Ignore and @Isolate now work when composed #2279
- Finalize spec is now properly called in all situations #2272
- Arb.bigDecimal bounds are not being honored #2357
- Fix for running individual test using WordSpec inside intellij #2319
4.6.0 May 2021
This is a small release which adds support for Kotlin 1.5 while remaining compatible with Kotlin 1.4.x
Bugfixes.
- All internal logging now uses lazy functions which offers a significant speed up on large test suites. Thanks to Łukasz Wasylkowski who spent considerable time tracking down this performance issue.
- Fixed false negative results by Inspectors when used inside assertSoftly. #2245
Features / Improvement
- Test config can now be specified at the test container level in addition to the leaf level #1370 #2050 #2065
- In data driven tests, added
IsStableTypeannotation which when use on a type, kotest will calltoStringmethod on that type for creating test name. See updated docs #2248 - In data driven tests, added
WithDataTestNameinterface which allow a type to modify the test name generated. See updated docs #2248 - Reflection methods are cached to avoid slow reflection calls.
- Added experimental versions of
eventually,until, andcontinuallythat don't usekotlin.timeinternally. See updated docs #2149 - Coroutines upgraded to 1.5 which also allows us to release assertions/property tests for watchosX64
- WatchosX64 artifacts released for assertions and property tests.
Contributors
Ashish Kumar Joy, Jim Schneidereit, Łukasz Wasylkowski, sksamuel
4.5.0 May 2021
As part of this release, third party extensions were promoted to top level repositories instead of modules inside the main kotest repo. This allows the extensions to iterate quickly, without needing to wait for a full Kotest release.
From 4.5 onwards, the namespace for all extensions has changed to io.kotest.extensions and the versioning reset to 1.0.0.
So, for example, if you used the Spring extension, you would previously have added io.kotest:kotest-extensions-spring:4.x.y to your build.
Now you would use io.kotest.extensions:kotest-extensions-spring:1.x.y
See the full list of extension modules.
Breaking Changes
- In order to use
ExperimentalKotestmore broadly, it was moved fromio.kotest.core.config.ExperimentalKotesttoio.kotest.common.ExperimentalKotest. #1950 - In order to ensure the
EventuallyListeneris called ineventuallywhen an exception is thrown theListenerStatefieldresultwas changed from typeTto typeT?. This will allow insight into when the eventually producer function is failing for whatever reason instead of appearing as if it is hanging. #2190 - Property tests now randomly cycle between edge cases and samples, rather than iterating all edge cases first. This allows greater number of edge cases to be used and avoids a combinatoral explosion. If you are implementing custom Arb's by extending the Arb class (instead of using the
arbitrarybuilders), then you will need to adjust your edge cases method fromfun edgecases(): List<A>tofun edgecase(rs: RandomSource): A?. - Because of the above property test change, if you are setting a seed in a property test you may need to adjust the value.
- The kotlin stdlib dependencies are now marked as
compileOnly, meaning the version in your build will be used. Kotest tries to maintain compatibility across multiple versions by not relying on features only available in the latest releases. - Duplicated test names no longer throw an automatic error, but now mangle the name. So two tests of name 'foo' will appear as 'foo' and '(1) foo'. This enables data driven testing to work properly in javascript. To restore the original behavior, set the configuration value
Configuration.duplicateTestNameMode = Error.
Features / Improvement
- A new data testing module has been added
kotest-framework-datatestwhich properly supports runtime nesting of data tests. See updated docs #2078 - Added new matcher for DayOfWeek in
kotest-assertion-clockmodule. #2124 - Added factory method to simplify creating new matchers. #2122
- Added method in
Exhaustiveto create a newExhaustivewhich will be a cartesian product of given twoExhaustive. #2120 - Added support for writing tests inside an object as well as class. #1970
- Added suspend version of
shouldCompleteWithin,shouldCompleteBetweenandshouldTimeOut. #2107 - Added kotest-extensions-wiremock project for managing lifecycle of
WireMockServerin Kotest test. #2108 - Added kotest-extensions-kafka project for using embedded kafka in your tests
- Upgrade
klockdependency to 2.0.6 and addedbrowser,nodejs,linuxX64,mingwX64,macosX64,tvos,iosX64,iosArm64andiosArm32platform targets forkotest-assertions-klock. #2116 - Run eventually one final time if iterations is one and delay is greater than the interval #2105
- Some improvement around
eventually.
(1) MakesEventuallyPredicatea type alias instead of interface for better user experience.
(2) Update failure message to inform the user about failure of givenEventuallyPredicate.
(3) Adds an overload ofeventuallywhich does not acceptEventuallyPredicateso that it gives a feel ofuntilfunction. - Added
shouldBeEqualToComparingFieldsandshouldBeEqualToComparingFieldsExceptmatchers which check equality of actual and expected by comparing their fields instead of usingequalsmethod. #2197 oneandanyhave been added as alternatives toassertSoftly. These are suspending methods that will check that only a single assertion succeeded (in the case ofone) or that at least one assertion succeeded (in the case ofany). #1950- New reporter added to generate HTML reports #2011
Exhaustive.cartesianhas been added #2119kotest.tagscan now be set via ENV Vars #2098- Edgecases are now probabilistic based #2112
- TestResult should support a reason why tests were skipped #2172
- Add watchos support back for x86 #2204
- Add overload to
Double.plusOrMinusthat accepts a percentage value instead of an absolute one.1.0.plusOrMinus(10.percent)
Bugfixes.
- Fixes eventually failing inside assert softly block without retrying the given lambda. #2092
- Fixes any other implementation of
Listenerapart fromProjectListenernot getting picked by Kotest framework. #2088 - Fixes
EventuallyListenernot being called ineventuallywhen the producer function throws an exception. #2190 - Use the classname as the default prefix for temporary files #2140
- Fix for
SystemExitListenerand picocli framework #2156 - Fix for
Arb.choose(arb, arb2, ...)not generating random values #2176 - Using checkAll, forAll and using take on an Arb cause an InvalidMutabilityException on XorWowRandom for Ios #2198
- Fix issues of passing vararg to another function in containsInOrder #2200
- The StringShrinker ignored min size limit #2213
- Fix for unlimited concurrency in spec execution when using experimental concurrency support #2177
- Synchronize access to Spring test contexts #2166
- Fixed typo in
haveClassAnnontationsmatcher. Existing incorrect spelling is deprecated. #2133
Deprecations
- Deprecated
instanceOf,beInstanceOf,beTheSameInstanceAs,beOfTypeof packageio.kotest.matchersthese will be removed permanently in 4.7 release, you can import these same assertion fromio.kotest.matchers.typespackage. - Remove deprecated eventually that uses durations for intervals. #2086
- Receivers used in test scopes have been renamed. For example,
DescribeScopehas becomeDescribeSpecContainerContext. The previous names exist as typealiases but are deprecated. This is only of importance if you implement custom spec types that inherit from the builtin specs or have defined extension methods on those scopes.
Contributors
- AJ Alt
- Alex Ordóñez
- Andreas Deininger
- Ashish Kumar Joy
- Dale King
- Hirotaka Kawata
- Hugo Martins
- Janek
- Jim Schneidereit
- Leonardo Colman
- Malte Esch
- Mateusz Kwieciński
- Mitchell Yuwono
- Nikita Klimenko
- Niklas Lochschmidt
- Rustam Musin
- Sean Flanigan
- Sebastian Schuberth
- Yoonho Sean Lee
- Zak Henry
- sksamuel
- tbcs
4.4.3 March 2021
- Removed verbose debugging statements that were erroneously left in the 4.4.2 release.
4.4.2 March 2021
Note: Release 4.4.2 is compiled against Kotlin 1.4.31 and coroutines 1.4.3
- Feature: The Javascript test artifacts are now compiled against the IR compiler in addition to current #2037
- Bugfix:
BeforeProjectListenerwas not always being detected - Bugfix: Using
shouldBewith throwables would compare using the message only #2094 - Bugfix: Fix
withEnvironment()to be case-insensitve on Windows #2099 - Bugfix: Fix
IncorrectDereferenceExceptionwhen calling assertions on background thread on native #2128 - Bugfix: Fix
Arb.bigdecimalhanging for some combinations of min and maxvalues #2135 - Improvement:
eventuallysometimes only checks a single time despite short scheduled intervals #2089 - Improvement: Updates error message for
shouldContainKeysmatcher to includes keys which are not present in given map #2106 - Improvement:
haveCauseOfTypeshows exception type instead of cause type #2131
4.4.1 February 2021
Note: Release 4.4.1 bumps the minimum required version of Kotlin to 1.4.30
- Fixed allure test grouping #1871
- Updated shouldBeEmpty and shouldNotBeEmpty to work for nullable references #2055
- Expose factor in exponential interval in eventually and until #2046
- Added cap to exponential and fibonacci intervals #2053
- Fix test name for data driven test when data class contains enum values #2034
- IntArray not being printed in Assert log #2042
- Fixed invalid json causing streaming error in json assertions #2045
- Generation of larger sets via Arb.set throws an exception #2051
- Avoid creating extra lambdas in blocking forAll #2036
4.4.0 February 2021
Note: Release 4.4.0 bumps the minimum required version of Kotlin to 1.4.21
Features / Improvements
- Add lazy property test generator #1651
- New map assertions #1697
- Property test framework is now deployed for native targets #1747
- Improve concurrency support for specs / tests #1760
- Variation of clue / asClue to accept lazy #1766
- New Map assertions shouldNotContainAnyKeysOf() shouldNotContainAnyValuesOf() #1769
- Add matchers for Atomic Booleans #1791
- Upgrade to Kotlin 1.4.20 #1800
- Test cases should have their tags appended to the test name if so configured #1804
- Add functionality to use 'it' without surrounding 'describe' #1827
- Added inline version for intanceOf alias #1838
- Add Support for globalAssertSoftly from System Property #1843
- Helper for temporary directory creation #1862
- shouldBeBetween not defined for floats #1927
- Increase arity of checkall / forall property tests to 12 #1929
- Add more configurations to Email Generator #1941
- not null matcher should show the value that was meant to be not null #1942
- Add SpringTestExtension which exposes test context via coroutine context element #1956
- Add active test extension #1959
- Upgrade ktor matchers to use ktor 1.5 #1965
- Allow data driven tests to register in root scope #1967
- Add domain arbitrary #1969
- Upgrade arrow matchers to 0.11.0 #1976
- Add alphanumeric codepoint arb #1989
Bugfixes
- Performance improvements for Exceptions on the JVM #1787
- Using a symbol or Japanese etc in the test name will change the behavior #1828
- Wrong behavior when combining assertSoftly and shouldNotBe #1831
- BehaviorSpec Then assertion shows green in Intellij but should show red #1857
- AssertionMode.Error doesn't work on FeatureSpec #1864
- Invalid test usage should throw at runtime #1882
- Output from reporters should be single threaded #1895
- Arb.set with a range hangs the test if the given gen inside the set cannot produce enough values for the range #1931
4.3.2 December 2020
Features
- Assertions library now released for watchos32 in addition to all other targets
- Allow using
itfor creating test outside of describe block - Added Arb.lazy and Exhaustive.lazy
Bugfix
- A Kotlin 1.4 specific method was added in 4.3.1 and reverted in 4.3.2
- Arb.choose does not currently include edge cases from input arbs #1886
- String shrinking is not being executed #1860
- Arb.stringPattern slows down the test dramatically #1878
- AssertionMode.Error doesn't work on FeatureSpec #1864
- Incomplete edge cases with the double generator #1869
- Unexpected ToleranceMatcher behavior at infinite doubles #1832
- Wrong behavior when combining assertSoftly and shouldNotBe #1831
- Fixed shouldContainJsonKeyValue to work with Long expected value and integer actual value #1790
4.3.1 November 2020
Features
- Variation of clue / asClue to accept lazy #1766
- Added Tuple2..Tuple22 for use in data testing #1773
Improvements
- Stacktrace recovery when an
eventuallyblock fails #1775 - Performance improvements for Exceptions on the JVM #1787
- Updated discovery to only initialize spec classes #1788
Bugfix
- Added stable identifiers when using new data-driven tests with non-data classes #1795
- Wrong TimeoutException messages shown when test exceeds spec-level invocation timeout #1809
- Invocation timeouts should not be applied to containers #1810
- Arb.filter causing stackoverflow #1818
- Arb.shuffle type signature change broken in 4.3.0 #1824