Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use kotest-assertions #408

Open
petertrr opened this issue Jun 23, 2022 · 0 comments
Open

Use kotest-assertions #408

petertrr opened this issue Jun 23, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers refactoring tests

Comments

@petertrr
Copy link
Member

petertrr commented Jun 23, 2022

kotest-assertions support multiplatform and are much more expressive than what's available in kotlin.test.

For example, this code

reporter.results.forEach { testResult ->
            assertTrue(!testResult.debugInfo!!.execCmd!!.contains("chapter"))
        }

will fail with Expected value to be true.. However with kotest it can be rewritten similarly to

reporter.results shouldNot exist { testResult ->
        testResult.debugInfo!!.execCmd!!.contains("chapter")
}

which will on failure describe the collection that has been tested

@petertrr petertrr added enhancement New feature or request good first issue Good for newcomers tests refactoring labels Jun 23, 2022
petertrr added a commit that referenced this issue Dec 1, 2022
* Add kotest assertions to common test dependencies
* Start using them in some tests
* Remove duplicated conversion to sequence

Part of #408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers refactoring tests
Projects
None yet
Development

No branches or pull requests

1 participant