Use strings – not identifiers – to clearly describe the behaviour you are testing. Test reports produced by Cuppa read like good documentation.
Create structure in your test files to reduce repetition and improve readability. Groups of tests can share setup and teardown steps.
Cuppa makes it trivial to write parameterised tests. It's as simple as a for
loop.
Cuppa is also easy to extend - there's no need to write annotations.
The syntax for writing tests in Cuppa can seem surprising at first, especially if you’re used to writing tests in JUnit or TestNG.
@Test
public class ListTest {
{
describe("List", () -> {
describe("#indexOf", () -> {
it("returns -1 when the value is not present", () -> {
List<Integer> list = Arrays.asList(1, 2, 3);
assertThat(list.indexOf(5)).isEqualTo(-1);
});
});
});
}
}