Open
Description
Proposal
Tests are currently written with JUnit 4 and I believe we should move to JUnit 5:
- JUnit 5 makes easier to parameterize a test
- JUnit 5 makes easier to organize tests (e.g. through
@Nested
and@DisplayName
):
I believe this is important because some test classes are becoming heavy (BuildTest
is 1k lines, EvalTest
is 1.3k and TypeValidatorTest
1.6k) which makes harder and harder to browse existing tests and can lead to duplicated tests.
Moreover, I suggest adopting AssertJ which fluent API makes tests much more readable:
@Test @DisplayName("executes all its tasks")
void executes_all_its_tasks() {
split.run(context);
assertThat(split.branches()).allMatch(Activity::hasRun);
}
AssertJ also provides SoftAssertions, a way to test several predicates at once. We currently have a lot of tests that stop early in case of failure and do not check all their predicates which hence could benefit from this API, e.g.:
To be done
- Add JUnit 5 & AssertJ to the target platform (warning: they are in Orbit, which may slow down first Maven build)
- Make current tests use JUnit 5 and AssertJ
Discussion
@dvojtise do you see any reason to stick to JUnit 4?
Metadata
Metadata
Assignees
Labels
No labels