public class AbstractProjectConfig
Project-wide configuration. Extensions returned by an
instance of this class will be applied to all interface Spec and class TestCases.
Create an object that is derived from this class, name the object ProjectConfig
and place it in your classpath in a package called io.kotlintest.provided.
KotlinTest will detect its presence and use it when executing tests.
Note: This is a breaking change from versions 2.0 and before, in which KotlinTest would scan the classpath for instances of this class. It no longer does that, in favour of the predefined package name + classname.
interface Spec,
class TestCase| Constructor and Description |
|---|
AbstractProjectConfig()
Project-wide configuration. Extensions returned by an
instance of this class will be applied to all
interface Spec and class TestCases. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterAll()
Executed after the last test of the project, but before the
ProjectExtension.afterAll methods. |
void |
beforeAll()
Executed before the first test of the project, but after the
ProjectExtension.beforeAll methods. |
java.util.List<io.kotlintest.extensions.ProjectLevelExtension> |
extensions()
List of project wide extensions, ie instances of
interface ProjectLevelExtension |
java.util.List<io.kotlintest.ProjectLevelFilter> |
filters()
List of project wide
interface TestCaseFilter instances. |
boolean |
getFailOnIgnoredTests()
Override this value and set it to true if you want the build to be marked as failed
if there was one or more tests that were disabled/ignored.
|
boolean |
getGlobalAssertSoftly()
Override this value and set it to true if you want all tests to behave as if they
were operating in an assertSoftly block.
|
java.util.List<io.kotlintest.extensions.TestListener> |
listeners()
List of project wide
interface TestListener instances. |
int |
parallelism()
Override this function and return a number greater than 1 if you wish to
enable parallel execution of tests. The number returned is the number of
concurrently executing specs.
|
SpecExecutionOrder |
specExecutionOrder()
Override this function and return an instance of
interface SpecExecutionOrder which will
be used to sort specs before execution. By default, will return specs in
lexicographic order. |
TestCaseOrder |
testCaseOrder()
Sets the order of top level tests in a spec.
The value set here will be used unless overriden in a
interface Spec.
The value in a interface Spec is always taken in preference to the value here.
Nested tests will always be executed in discovery order. |
boolean |
writeSpecFailureFile()
When set to true, failed specs are written to a file called spec_failures.
This file is used on subsequent test runs to run the failed specs first.
|
public AbstractProjectConfig()
Project-wide configuration. Extensions returned by an
instance of this class will be applied to all interface Spec and class TestCases.
Create an object that is derived from this class, name the object ProjectConfig
and place it in your classpath in a package called io.kotlintest.provided.
KotlinTest will detect its presence and use it when executing tests.
Note: This is a breaking change from versions 2.0 and before, in which KotlinTest would scan the classpath for instances of this class. It no longer does that, in favour of the predefined package name + classname.
interface Spec,
class TestCasepublic java.util.List<io.kotlintest.extensions.ProjectLevelExtension> extensions()
List of project wide extensions, ie instances of interface ProjectLevelExtension
interface ProjectLevelExtensionpublic java.util.List<io.kotlintest.extensions.TestListener> listeners()
List of project wide interface TestListener instances.
interface TestListenerpublic java.util.List<io.kotlintest.ProjectLevelFilter> filters()
List of project wide interface TestCaseFilter instances.
interface TestCaseFilterpublic SpecExecutionOrder specExecutionOrder()
Override this function and return an instance of interface SpecExecutionOrder which will
be used to sort specs before execution. By default, will return specs in
lexicographic order.
Implementations are currently:
public int parallelism()
Override this function and return a number greater than 1 if you wish to enable parallel execution of tests. The number returned is the number of concurrently executing specs.
An alternative way to enable this is the system property kotlintest.parallelism which will always (if defined) take priority over the value here.
public boolean writeSpecFailureFile()
When set to true, failed specs are written to a file called spec_failures. This file is used on subsequent test runs to run the failed specs first.
To enable this feature, set this to true, or set the system property 'kotlintest.write.specfailures=true'
public TestCaseOrder testCaseOrder()
Sets the order of top level tests in a spec.
The value set here will be used unless overriden in a interface Spec.
The value in a interface Spec is always taken in preference to the value here.
Nested tests will always be executed in discovery order.
If this function returns null then the default of Sequential will be used.
interface Spec,
interface Specpublic boolean getGlobalAssertSoftly()
Override this value and set it to true if you want all tests to behave as if they were operating in an assertSoftly block.
public boolean getFailOnIgnoredTests()
Override this value and set it to true if you want the build to be marked as failed if there was one or more tests that were disabled/ignored.
public void beforeAll()
Executed before the first test of the project, but after the
ProjectExtension.beforeAll methods.
ProjectExtension.beforeAllpublic void afterAll()
Executed after the last test of the project, but before the
ProjectExtension.afterAll methods.
ProjectExtension.afterAll