kotlin-testing

Solid

Kotlin testing with JUnit 5, Kotest, and coroutine dispatchers.

Testing & QA 392 stars 36 forks Updated today MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
86
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Kotlin Testing Patterns ## JUnit 5 Fundamentals Use `@Test` for simple test cases. Prefer `@DisplayName` for readable test names. ```kotlin import org.junit.jupiter.api.Test import org.junit.jupiter.api.DisplayName import kotlin.test.assertEquals import kotlin.test.assertFailsWith class UserServiceTest { @Test @DisplayName("should return user by ID when user exists") fun findUserById() { val service = UserService(FakeUserRepository()) val user = service.findById(1L) assertEquals("Alice", user.name) } @Test fun `should throw when user not found`() { val service = UserService(FakeUserRepository()) assertFailsWith<UserNotFoundException> { service.findById(999L) } } } ``` ## Parameterized Tests Use `@ParameterizedTest` with `@MethodSource` for complex inputs or `@CsvSource` for simple value pairs. ```kotlin import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.CsvSource import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.Arguments import java.util.stream.Stream class ValidatorTest { @ParameterizedTest @CsvSource( "alice@example.com, true", "not-an-email, false", "'', false" ) fun `should validate email addresses`(input: String, expected: Boolean) { assertEquals(expected, EmailValidator.isValid(input)) } @ParameterizedTest @MethodSource("provi...

Details

Author
notque
Repository
notque/vexjoy-agent
Created
2 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category