public TestListener
| Modifier and Type | Interface and Description |
|---|---|
static class |
TestListener.DefaultImpls |
| Modifier and Type | Method and Description |
|---|---|
void |
afterDiscovery(java.util.List<io.kotlintest.Description> descriptions)
Is invoked after all the
interface Spec classes have been discovered.
This callback will be called after any interface DiscoveryExtensions have been invoked. |
void |
afterProject()
Is invoked once the Test Engine has finished.
|
void |
afterSpec(Spec spec)
Is invoked after the
class TestCases that are part of a particular
interface Spec instance have completed. |
void |
afterSpec(Description description,
Spec spec)
Deprecated.
|
void |
afterSpecClass(Spec spec,
java.util.Map<io.kotlintest.TestCase,io.kotlintest.TestResult> results)
Called once per
interface Spec, after all tests have completed for that spec. |
void |
afterSpecCompleted(Description description,
Spec spec)
Deprecated.
|
void |
afterTest(TestCase testCase,
TestResult result)
This callback is invoked after a
class TestCase has finished. |
void |
afterTest(Description description,
TestResult result)
Deprecated.
|
void |
beforeProject()
Is invoked once the Test Engine is started.
|
void |
beforeSpec(Spec spec)
This callback is invoked after the Engine instantiates a
interface Spec
to be used as part of a class TestCase execution. |
void |
beforeSpec(Description description,
Spec spec)
Deprecated.
|
void |
beforeSpecClass(Spec spec,
java.util.List<io.kotlintest.extensions.TopLevelTest> tests)
Called once per
interface Spec, when the engine is preparing to
execute the tests for that spec. |
void |
beforeSpecStarted(Description description,
Spec spec)
Deprecated.
|
void |
beforeTest(TestCase testCase)
This callback will be invoked before a
class TestCase is executed. |
void |
beforeTest(Description description)
Deprecated.
|
void beforeProject()
Is invoked once the Test Engine is started.
void afterProject()
Is invoked once the Test Engine has finished.
void beforeTest(TestCase testCase)
This callback will be invoked before a class TestCase is executed.
If a test case is inactive (disabled), then this method will not be invoked for that particular test case.
testCase - the class TestCase about to be executed.class TestCasevoid afterTest(TestCase testCase, TestResult result)
This callback is invoked after a class TestCase has finished.
If a test case was skipped (ignored / disabled / inactive) then this callback will not be invoked for that particular test case.
testCase - the class TestCase that has completed.class TestCasevoid beforeSpec(Spec spec)
This callback is invoked after the Engine instantiates a interface Spec
to be used as part of a class TestCase execution.
If a spec is instantiated multiple times - for example, if InstancePerTest or InstancePerLeaf isolation modes are used, then this callback will be invoked for each instance created, just before the first test (or only test) is executed for that spec.
This callback should be used if you need to perform setup
each time a new spec instance is created. If you simply need to
perform setup once per class file, then use TestListener.beforeSpecClass.
spec - the interface Spec instance.interface Spec,
class TestCase,
TestListener.beforeSpecClassvoid afterSpec(Spec spec)
Is invoked after the class TestCases that are part of a particular
interface Spec instance have completed.
If a spec is instantiated multiple times - for example, if InstancePerTest or InstancePerLeaf isolation modes are used, then this callback will be invoked for each instantiated spec, after the tests that are applicable to that spec instance have returned.
This callback should be used if you need to perform cleanup
after each individual spec instance. If you simply need to
perform cleanup once per class file, then use TestListener.afterSpecClass.
spec - the interface Spec instance.class TestCase,
interface Spec,
TestListener.afterSpecClassvoid beforeSpecClass(Spec spec, java.util.List<io.kotlintest.extensions.TopLevelTest> tests)
Called once per interface Spec, when the engine is preparing to
execute the tests for that spec.
Regardless of how many times the spec is instantiated, for example, if InstancePerTest or InstancePerLeaf isolation modes are used, this callback will only be invoked once, with the first instance of the Spec.
The top level tests declared in the spec are supplied as a list of
instances of class TopLevelTest which includes a flag set to true if
the test is active or false if inactive.
If there are no active tests in a spec, then this callback will still be invoked.
The order of the list of tests is the same as the order of execution.
spec - the interface Spec instancetests - the list of top level testsinterface Spec,
class TopLevelTestvoid afterSpecClass(Spec spec, java.util.Map<io.kotlintest.TestCase,io.kotlintest.TestResult> results)
Called once per interface Spec, after all tests have completed for that spec.
Regardless of how many times the spec is instantiated, for example, if InstancePerTest or InstancePerLeaf isolation modes are used, this callback will only be invoked once, with the first instance of the Spec.
The results parameter contains every class TestCase, along with
the result of that test, including tests that were ignored (which
will have a TestResult that has TestStatus.Ignored)
spec - the interface Spec instanceresults - a map of each test case mapped to its result.interface Spec,
class TestCasevoid afterDiscovery(java.util.List<io.kotlintest.Description> descriptions)
Is invoked after all the interface Spec classes have been discovered.
This callback will be called after any interface DiscoveryExtensions have been invoked.
In other words the descriptions given here are after discovery extensions have had the chance to filter.
descriptions - the class Description instance for each Spec class discovered.interface Spec,
interface DiscoveryExtensionvoid beforeSpec(Description description, Spec spec)
Is invoked each time a interface Spec is started.
Note: If the spec is running with one instance per test, then this function will be invoked multiple times.
description - the class Description for the root class TestCase of the spec.spec - the actual interface Spec instance.interface Specvoid afterSpec(Description description, Spec spec)
Is invoked each time a interface Spec completes.
Note: If the spec is running with one instance per test, then this function will be invoked multiple times.
description - the class Description for the root class TestCase of the spec.spec - the actual interface Spec instance.interface Specvoid beforeTest(Description description)
This function will be invoked each time a new class TestCase is executed.
description - the class Description for the class TestCase instance.class TestCasevoid afterTest(Description description, TestResult result)
Is invoked when a class TestCase has finished. This includes when a test case
is ignored (skipped), passes (is successful), or fails (errors).
description - the class Description for the class TestCase instance.result - the class TestResult which contains the outcome of the test.class TestCasevoid beforeSpecStarted(Description description, Spec spec)
void afterSpecCompleted(Description description, Spec spec)