Package-level declarations

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Annotations to mark test functions and top-level functions for performing assertions in tests.

Types

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class AfterClass

Marks a function to be executed after a suite. Not supported in Kotlin/Common.

Since Kotlin 1.3
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
expect annotation class AfterTest

Marks a function to be invoked after each test.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class AfterTest

Marks a function to be invoked after each test.

Since Kotlin 1.1
actual typealias AfterTest = After
Since Kotlin 1.0
actual typealias AfterTest = AfterEach
Since Kotlin 1.0
actual typealias AfterTest = AfterMethod
Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class AfterTest

Marks a function to be invoked after each test.

Since Kotlin 1.3
Link copied to clipboard
interface Asserter

Abstracts the logic for performing assertions. Specific implementations of Asserter can use JUnit or TestNG assertion facilities.

Since Kotlin 1.0
Link copied to clipboard

Checks applicability and provides Asserter instance

Since Kotlin 1.0
Link copied to clipboard
external interface AssertionResult

Describes the result of an assertion execution.

Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class BeforeClass

Marks a function to be executed before a suite. Not supported in Kotlin/Common.

Since Kotlin 1.3
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
expect annotation class BeforeTest

Marks a function to be invoked before each test.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class BeforeTest

Marks a function to be invoked before each test.

Since Kotlin 1.1
actual typealias BeforeTest = Before
Since Kotlin 1.0
actual typealias BeforeTest = BeforeEach
Since Kotlin 1.0
actual typealias BeforeTest = BeforeMethod
Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class BeforeTest

Marks a function to be invoked before each test.

Since Kotlin 1.3
Link copied to clipboard

Default Asserter implementation to avoid dependency on JUnit or TestNG.

Since Kotlin 1.0
Link copied to clipboard
external interface FrameworkAdapter

Serves as a bridge to a testing framework.

Since Kotlin 1.1
Link copied to clipboard
expect annotation class Ignore

Marks a test or a suite as ignored.

Since Kotlin 1.0
actual annotation class Ignore

Marks a test or a suite as ignored.

Since Kotlin 1.1
actual typealias Ignore = org.junit.Ignore
Since Kotlin 1.0
actual typealias Ignore = Disabled
Since Kotlin 1.0
actual typealias Ignore = org.testng.annotations.Ignore
Since Kotlin 1.0
actual annotation class Ignore

Marks a test or a suite as ignored.

Since Kotlin 1.3
Link copied to clipboard
external interface KotlinTestNamespace
Since Kotlin 1.1
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
expect annotation class Test

Marks a function as a test.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class Test

Marks a function as a test.

Since Kotlin 1.1
actual typealias Test = org.junit.Test
Since Kotlin 1.0
actual typealias Test = org.junit.jupiter.api.Test
Since Kotlin 1.0
actual typealias Test = org.testng.annotations.Test
Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
actual annotation class Test

Marks a function as a test.

Since Kotlin 1.3

Properties

Link copied to clipboard

Current adapter providing assertion implementations

Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.1

Functions

Link copied to clipboard
fun <T> assertEquals(expected: T, actual: T, message: String? = null)

Asserts that the expected value is equal to the actual value, with an optional message.

Since Kotlin 1.0
Link copied to clipboard
@JvmName(name = "assertFailsInline")
inline fun assertFails(block: () -> Unit): Throwable

Asserts that given function block fails by throwing an exception.

Since Kotlin 1.0
@JvmName(name = "assertFailsInline")
inline fun assertFails(message: String?, block: () -> Unit): Throwable

Asserts that given function block fails by throwing an exception.

Since Kotlin 1.1
Link copied to clipboard
inline fun <T : Throwable> assertFailsWith(message: String? = null, block: () -> Unit): T

Asserts that a block fails with a specific exception of type T being thrown.

Since Kotlin 1.0
@JvmName(name = "assertFailsWithInline")
inline fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, block: () -> Unit): T
@JvmName(name = "assertFailsWithInline")
inline fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T

Asserts that a block fails with a specific exception of type exceptionClass being thrown.

Since Kotlin 1.0
Link copied to clipboard
fun assertFalse(actual: Boolean, message: String? = null)

Asserts that the expression is false with an optional message.

Since Kotlin 1.0
@JvmName(name = "assertFalseInline")
inline fun assertFalse(message: String? = null, block: () -> Boolean)

Asserts that the given block returns false.

Since Kotlin 1.0
Link copied to clipboard
fun <T> assertNotEquals(illegal: T, actual: T, message: String? = null)

Asserts that the actual value is not equal to the illegal value, with an optional message.

Since Kotlin 1.0
Link copied to clipboard
fun <T : Any> assertNotNull(actual: T?, message: String? = null): T

Asserts that the actual value is not null, with an optional message.

Since Kotlin 1.0
@JvmName(name = "assertNotNullInline")
inline fun <T : Any, R> assertNotNull(actual: T?, message: String? = null, block: (T) -> R)

Asserts that the actual value is not null, with an optional message and a function block to process the not-null value.

Since Kotlin 1.0
Link copied to clipboard
fun <T> assertNotSame(illegal: T, actual: T, message: String? = null)

Asserts that actual is not the same instance as illegal, with an optional message.

Since Kotlin 1.0
Link copied to clipboard
fun assertNull(actual: Any?, message: String? = null)

Asserts that the actual value is null, with an optional message.

Since Kotlin 1.0
Link copied to clipboard
fun <T> assertSame(expected: T, actual: T, message: String? = null)

Asserts that expected is the same instance as actual, with an optional message.

Since Kotlin 1.0
Link copied to clipboard
fun assertTrue(actual: Boolean, message: String? = null)

Asserts that the expression is true with an optional message.

Since Kotlin 1.0
@JvmName(name = "assertTrueInline")
inline fun assertTrue(message: String? = null, block: () -> Boolean)

Asserts that the given block returns true.

Since Kotlin 1.0
Link copied to clipboard

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.

Since Kotlin 1.0
Link copied to clipboard
@JvmName(name = "expectInline")
inline fun <T> expect(expected: T, block: () -> T)

Asserts that given function block returns the given expected value.

Since Kotlin 1.0
@JvmName(name = "expectInline")
inline fun <T> expect(expected: T, message: String?, block: () -> T)

Asserts that given function block returns the given expected value and use the given message if it fails.

Since Kotlin 1.0
Link copied to clipboard
fun fail(message: String? = null): Nothing

Marks a test as having failed if this point in the execution path is reached, with an optional message.

Since Kotlin 1.0
fun fail(message: String? = null, cause: Throwable? = null): Nothing

Marks a test as having failed if this point in the execution path is reached, with an optional message and cause exception.

Since Kotlin 1.4
Link copied to clipboard
expect fun todo(block: () -> Unit)

Takes the given block of test code and doesn't execute it.

Since Kotlin 1.0
actual fun todo(block: () -> Unit)

Takes the given block of test code and doesn't execute it.

Since Kotlin 1.1
actual inline fun todo(block: () -> Unit)

Takes the given block of test code and doesn't execute it.

Since Kotlin 1.0
actual inline fun todo(block: () -> Unit)

Takes the given block of test code and doesn't execute it.

Since Kotlin 1.3