Skip to content

Latest commit

 

History

History
114 lines (58 loc) · 3.96 KB

Cookbook.md

File metadata and controls

114 lines (58 loc) · 3.96 KB

Minutest

Cookbook

Pronouncing Minutest

The name originally came from a trawl of words containing test - and so should be pronounced as if it has the sense 'smallest'.

However, when @duncanmcg read back his first message on the subject I'd like to run my new test framework past you, he realised that there was another pronunciation - 'My New Test', and that is the emphasis that seems to have stuck.

Writing Tests

See the readme

Running Tests with JUnit 5

See the readme

Running Tests with JUnit 4

There is experimental support for running tests with JUnit 4 - see JUnit4MinutestsTests

Understanding Fixtures and Contexts

Understanding fixtures is key to Minutest - read more

Running Only Some Tests

There is experimental support for skipping some tests and only running others

Repeating Tests

Repeating Tests

TDD with Minutest

Test Driven to Specification with Minutest - Part 1

Specs with Minutest

Test Driven to Specification with Minutest - Part 2

Running a Test With Different Values

Parameterised Tests

Generating tests on the fly

Generating tests

Changing the Fixture Type Between Contexts

Derived Contexts

Using JUnit Rules

JUnit Rules mostly work.

Mocking Collaborators

JMock

Approval Tests with Minutest

It's easy to integrate Okeydoke - see Minutest Examples

Spring Integration

You can easily populate a fixture with the same annotations you would use in JUnit - see Minutest Examples

Stopping IntelliJ Showing Test Methods As Unused

Annotate the method with dev.minutest.Tests, Alt-Enter on the greyed-out method and select Suppress unused warning if annotated by 'dev.minutest.Tests'. Now all @Tests methods should not be greyed out.

Testing with Coroutines

Simple tests with coroutines

More elaborate tests with coroutines

Structuring Tests

Given When Then

Reusing Test Code

Contracts

Managing Test Resources

You can use before, after and afterAll blocks in a context to manage resources.

For simple cases there is a closeableFixture block

Getting Help

The best bet for feedback and help is the #minutest channel on the Kotlin Slack. See you there.

Tracing Test Execution

TODO - in the meantime just ask.

Checking a Value

TODO - in the meantime just ask.

Extending Minutest

TODO - in the meantime just ask.

Migrating from JUnit

TODO - in the meantime just ask.