Package kotlin.test
Annotations to mark test functions and top-level functions for performing assertions in tests.
Types
interface Asserter Abstracts the logic for performing assertions. Specific implementations of Asserter can use JUnit or TestNG assertion facilities. |
|
interface AsserterContributor Checks applicability and provides Asserter instance |
|
external interface AssertionResult Describes the result of an assertion execution. |
|
class DefaultAsserter : Asserter Default Asserter implementation to avoid dependency on JUnit or TestNG. |
|
external interface FrameworkAdapter Serves as a bridge to a testing framework. |
Annotations
annotation class AfterTest Marks a function to be invoked after each test. |
|
annotation class BeforeTest Marks a function to be invoked before each test. |
|
annotation class Ignore Marks a test or a suite as ignored. |
|
annotation class Test Marks a function as a test. |
Type Aliases
actual typealias AfterTest = After |
|
actual typealias BeforeTest = Before |
|
actual typealias Ignore = Ignore |
|
actual typealias Test = Test |
Properties
val asserter: Asserter Current adapter providing assertion implementations |
Functions
Asserts that the expected value is equal to the actual value, with an optional message. |
|
Asserts that given function block fails by throwing an exception. |
|
Asserts that a block fails with a specific exception of type T being thrown. Since inline method doesn't allow to trace where it was invoked, it is required to pass a message to distinguish this method call from others. expect fun <T : Throwable> assertFailsWith( Asserts that a block fails with a specific exception of type exceptionClass being thrown. |
|
Asserts that the given block returns Asserts that the expression is |
|
Asserts that the actual value is not equal to the illegal value, with an optional message. |
|
Asserts that the actual value is not Asserts that the actual value is not |
|
Asserts that actual is not the same instance as illegal, with an optional message. |
|
Asserts that the actual value is |
|
Asserts that expected is the same instance as actual, with an optional message. |
|
Asserts that the given block returns Asserts that the expression is |
|
fun <T> CollectionAssertionSession<T, *>. |
|
fun currentStackTrace(): Array<StackTraceElement> Returns an array of stack trace elements, each representing one stack frame. The first element of the array (assuming the array is not empty) represents the top of the stack, which is the place where currentStackTrace function was called from. |
|
Asserts that given function block returns the given expected value. Asserts that given function block returns the given expected value and use the given message if it fails. |
|
Marks a test as having failed if this point in the execution path is reached, with an optional message. |
|
fun <T> CollectionAssertionSession<T, *>. |
|
fun <C : Collection<*>> CollectionAssertionSession<*, C>. |
|
Comments out a block of test code until it is implemented while keeping a link to the code to implement in your unit test output |