Test
Marks a function as a test.
Only class member functions should be annotated with Test, the annotated function should not accept any parameters and its return type has to be Unit.
Applying Test to top-level, extension, or object member functions, functions accepting any parameters or functions with a return type other than Unit may lead to compilation or runtime errors, and behavior may vary on different targets.
import kotlin.test.*
public class ArithmeticsTest {
@Test
fun addition() {
assertEquals(4, 2 + 2)
}
}Since Kotlin
1.0Marks a function as a test.
Only class member functions could be annotated with Test, the annotated function should not accept any parameters and its return type has to be Unit.
Applying Test to top-level, extension, or object member functions, functions accepting any parameters or functions with a return type other than Unit may lead to compilation or runtime errors, and behavior may vary on different targets.
import kotlin.test.*
public class ArithmeticsTest {
@Test
fun addition() {
assertEquals(4, 2 + 2)
}
}Since Kotlin
1.1Since Kotlin
1.0Since Kotlin
1.0Since Kotlin
1.0Marks a function as a test.
Only class member functions could be annotated with Test, the annotated function should not accept any parameters and its return type has to be Unit.
Applying Test to top-level, extension, or object member functions, functions accepting any parameters or functions with a return type other than Unit may lead to compilation or runtime errors, and behavior may vary on different targets.
import kotlin.test.*
public class ArithmeticsTest {
@Test
fun addition() {
assertEquals(4, 2 + 2)
}
}Since Kotlin
1.3Marks a function as a test.
Only class member functions could be annotated with Test, the annotated function should not accept any parameters and its return type has to be Unit.
Applying Test to top-level, extension, or object member functions, functions accepting any parameters or functions with a return type other than Unit may lead to compilation or runtime errors, and behavior may vary on different targets.
import kotlin.test.*
public class ArithmeticsTest {
@Test
fun addition() {
assertEquals(4, 2 + 2)
}
}Since Kotlin
1.8Marks a function as a test.
Only class member functions could be annotated with Test, the annotated function should not accept any parameters and its return type has to be Unit.
Applying Test to top-level, extension, or object member functions, functions accepting any parameters or functions with a return type other than Unit may lead to compilation or runtime errors, and behavior may vary on different targets.
import kotlin.test.*
public class ArithmeticsTest {
@Test
fun addition() {
assertEquals(4, 2 + 2)
}
}