public interface TestBuilder
This class helps you decorate a test or block of tests with additional options. Test builders are obtained from
various methods of Cuppa.
with(tags("slow")).
it("takes a long time to start", () -> {
// ...
});
Cuppa| Modifier and Type | Method and Description |
|---|---|
void |
describe(java.lang.String description,
TestBlockFunction function)
Registers a described suite of tests to be run.
|
void |
it(java.lang.String description)
Registers a pending test.
|
void |
it(java.lang.String description,
TestFunction function)
Registers a test function to be run.
|
TestBuilder |
only()
Mark a test or block of tests as the only tests that should be run.
|
TestBuilder |
skip()
Mark a test or block of tests to be skipped.
|
void |
when(java.lang.String description,
TestBlockFunction function)
Registers a 'when' block to be run.
|
TestBuilder |
with(Option<?>... options)
Decorate a test or block of tests with additional options.
|
TestBuilder with(Option<?>... options)
Cuppa.tags(String...).
Multiple options can be either passed as additional arguments or chained using the returned builder.
with(tags("slow")).
it("takes a long time to start", () -> {
// ...
});
options - Options to apply to the test/block.Cuppa.with(Option...)TestBuilder skip()
The test(s) may still be included in test reports, but marked as skipped.
skip().it("does something", () -> {
// Will not be run.
});
Cuppa.skip()TestBuilder only()
If at least one test is marked as only then all tests not marked as only will not be run.
only().it("does something", () -> {
// ...
});
Cuppa.only()void describe(java.lang.String description,
TestBlockFunction function)
description - The description of the 'describe' block.function - The 'describe' block.void when(java.lang.String description,
TestBlockFunction function)
description - The description of the 'when' block.function - The 'when' block.void it(java.lang.String description,
TestFunction function)
description - The description of the test.function - The test function.void it(java.lang.String description)
A pending test has no implementation and acts as a reminder to the developer to write the implementation later.
description - The description of the test.