I would like to have tests where assumptions fail ...
# kotest
e
I would like to have tests where assumptions fail show up as aborted rather than failed. Is there any way to abort a test and have it show up as such? When working with Junit we would throw an
IncompleteExecutionException
or specialization there-of.. I assume, when using Junit platform, it would be fine to import those exceptions and throw them? Is there any more "kotest-native" way of doing this?
s
You want the test to be red rather than yellow?
e
Hehe 🙂 Ideally shown as skipped, with a log message saying what assumption failed.. But I notice it does not happen when using
IncompleteExecutionException
either.
s
Can you show a screenshot of what you mean from junit
Tried to fake a good scenario for it but it felt really contrived.. but I would mostly use it when integration testing. For instance if we want
given a user with permissions X should  be able to do Y
, then creation and granting of permissions goes into an assumption block. If the assumptions fail, the test should show as aborted since the purpose of the test is to check that the user can do Y, not to test user creation or granting of permissions
j
Pretty good use case for enabledOrReasonIf