Skip to content

withOptions and withRepresentation as experimental feature

Compare
Choose a tag to compare
@robstoll robstoll released this 08 Feb 15:00
f6c7d03

Fixes

it was planned that withOptions ships with 0.9.0 (see #153). However, this was done only for the assertion verb which is used internally in Atrium but was not revealed for the predefined assertion verbs, hence this patch-version (thanks to @matejdro for the report - #362)

Most users won't use withOptions and thus we are going to present only withRepresentation for now (introduced in 0.9.2 #365).
❗❗Note though that withOptions and withRepresentation are both experimental and might be changed in a future version without previous notice nor migration path.

withRepresentation can be used as follows :

expect(listOf(1,2,2,3 /* imagine a lot more numbers */))
  .withRepresentation("xy numbers")
  .all { isLessThan(10) }

The error report looks then as follows in case of a failure:

expected that subject: xy numbers
◆ all entries: 
    » is less than: 10        (kotlin.Int <1234789>)
    ❗❗ following entries were mismatched: 
       ⚬ index 101: 12        (kotlin.Int <8933389>)
       ⚬ index 223: 10        (kotlin.Int <4523459>)

To use it, you have to add the following annotation to your test method/class @UseExperimental(ExperimentalWithOptions::class)

Further Improvements

  • #81 create sample MPP project => thanks to @bsemexan for most of the work

all other features as well a migration guide is given in the release notes of v0.9.0