public static class Spec.DefaultImpls
A interface Spec is the top level component in KotlinTest.
It contains the root class TestCase instances which in turn
can contain nested class TestCase instances.
For example, the FunSpec allows us to create tests using the "test(name)" function, such as:
fun test("this is a test") { // test code here }
The spec ultimately forms a tree, with the spec's root container at the root, and nested containers forming branches and test cases as the leaves. The actual hierarchy will depend on the spec being used.
A interface Spec is also a interface TestListener to allow for
convenience overloads here if you just want to listen
in a single place.
| Modifier and Type | Method and Description |
|---|---|
static void |
afterDiscovery(Spec $this,
java.util.List<io.kotlintest.Description> descriptions) |
static void |
afterProject(Spec $this) |
static void |
afterSpec(Spec $this,
Spec spec) |
static void |
afterSpec(Spec $this,
Description description,
Spec spec)
Deprecated.
|
static void |
afterSpecClass(Spec $this,
Spec spec,
java.util.Map<io.kotlintest.TestCase,io.kotlintest.TestResult> results) |
static void |
afterSpecCompleted(Spec $this,
Description description,
Spec spec)
Deprecated.
|
static void |
afterTest(Spec $this,
TestCase testCase,
TestResult result) |
static void |
afterTest(Spec $this,
Description description,
TestResult result)
Deprecated.
|
static void |
beforeProject(Spec $this) |
static void |
beforeSpec(Spec $this,
Spec spec) |
static void |
beforeSpec(Spec $this,
Description description,
Spec spec)
Deprecated.
|
static void |
beforeSpecClass(Spec $this,
Spec spec,
java.util.List<io.kotlintest.extensions.TopLevelTest> tests) |
static void |
beforeSpecStarted(Spec $this,
Description description,
Spec spec)
Deprecated.
|
static void |
beforeTest(Spec $this,
TestCase testCase) |
static void |
beforeTest(Spec $this,
Description description)
Deprecated.
|
static Description |
description(Spec $this) |
static java.util.List<io.kotlintest.extensions.SpecLevelExtension> |
extensions(Spec $this)
Override this function to register extensions
which will be invoked during execution of this spec.
|
static java.util.List<io.kotlintest.TestCase> |
focused(Spec $this)
Returns the focused tests for this Spec. Can be empty if no test is marked as focused.
|
static boolean |
hasFocusedTest(Spec $this) |
static IsolationMode |
isolationMode(Spec $this) |
static java.util.List<io.kotlintest.extensions.TestListener> |
listeners(Spec $this)
Override this function to register instances of
interface TestListener which will be notified of events during
execution of this spec. |
static java.util.Set<io.kotlintest.Tag> |
tags(Spec $this)
Any tags added here will be in applied to all
class TestCases defined
in this interface Spec in addition to any defined on the individual
tests themselves. |
static TestCaseOrder |
testCaseOrder(Spec $this)
Sets the order of top level
class TestCases in this spec.
If this function returns a null value, then the value set in
the class AbstractProjectConfig will be used. |
public static IsolationMode isolationMode(Spec $this)
public static java.util.List<io.kotlintest.extensions.SpecLevelExtension> extensions(Spec $this)
Override this function to register extensions which will be invoked during execution of this spec.
If you wish to register an extension across the project
then use AbstractProjectConfig.extensions.
AbstractProjectConfig.extensionspublic static java.util.List<io.kotlintest.extensions.TestListener> listeners(Spec $this)
Override this function to register instances of
interface TestListener which will be notified of events during
execution of this spec.
If you wish to register a listener that will be notified
for all specs, then use AbstractProjectConfig.listeners.
public static java.util.List<io.kotlintest.TestCase> focused(Spec $this)
Returns the focused tests for this Spec. Can be empty if no test is marked as focused.
public static boolean hasFocusedTest(Spec $this)
public static TestCaseOrder testCaseOrder(Spec $this)
Sets the order of top level class TestCases in this spec.
If this function returns a null value, then the value set in
the class AbstractProjectConfig will be used.
class TestCase,
class AbstractProjectConfigpublic static java.util.Set<io.kotlintest.Tag> tags(Spec $this)
Any tags added here will be in applied to all class TestCases defined
in this interface Spec in addition to any defined on the individual
tests themselves.
class TestCase,
interface Specpublic static Description description(Spec $this)
public static void beforeProject(Spec $this)
public static void afterProject(Spec $this)
public static void beforeTest(Spec $this, Description description)
public static void afterTest(Spec $this, TestCase testCase, TestResult result)
public static void afterTest(Spec $this, Description description, TestResult result)
public static void beforeSpec(Spec $this, Description description, Spec spec)
public static void afterSpec(Spec $this, Description description, Spec spec)
public static void beforeSpecClass(Spec $this, Spec spec, java.util.List<io.kotlintest.extensions.TopLevelTest> tests)
public static void afterSpecClass(Spec $this, Spec spec, java.util.Map<io.kotlintest.TestCase,io.kotlintest.TestResult> results)
public static void afterDiscovery(Spec $this, java.util.List<io.kotlintest.Description> descriptions)
public static void beforeSpecStarted(Spec $this, Description description, Spec spec)
public static void afterSpecCompleted(Spec $this, Description description, Spec spec)