원클릭으로
testing-mockk
Trigger: Unit Testing. Writing unit tests using MockK (no annotations), constructor injection, and InjectingTest patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Trigger: Unit Testing. Writing unit tests using MockK (no annotations), constructor injection, and InjectingTest patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Test-driven development with red-green-refactor loop. MUST be triggered during ANY coding session involving feature implementation or bug fixes or specifications.
Evaluates skills based on discoverability, agent-friendliness, and consumption efficiency. Returns a Letter Grade (A+ to F) and actionable coaching.
Validating agent skills against the agentskills.io specification and generating compliance reports.
Trigger: Data Flow & Modules. Implementing Repositories, managing cross-module boundaries, and handling async work with Coroutines.
Trigger: Pre-Commit/Final Review. Validating code against Serenity’s 'Golden Standards' for architecture, security, performance, and testing before merging.
Trigger: Presenter Logic. Managing Moxy MVP state, Presenter lifecycle, and view delegation without @InjectPresenter.
| name | testing-mockk |
| description | Trigger: Unit Testing. Writing unit tests using MockK (no annotations), constructor injection, and InjectingTest patterns. |
Standardized mocking requires explicit initialization to avoid reflection overhead and maintain consistency.
class MyPresenterTest {
private val mockView: MyView = mockk(relaxed = true)
private val mockRepo: MyRepository = mockk(relaxed = true)
// ...
}
When testing components that rely on field injection (Activities, Fragments), use the TestModule pattern.
Extend us.nineworlds.serenity.test.InjectingTest and install your mocks.
class MyActivityTest : InjectingTest() {
private val mockPresenter: MyPresenter = mockk(relaxed = true)
override fun installTestModules() {
scope.installModules(TestModule())
}
inner class TestModule : Module() {
init {
bind(MyPresenter::class.java).toInstance(mockPresenter)
}
}
@Before
override fun setUp() {
super.setUp()
// Activity/Fragment initialization logic
}
}
Crucial for preventing state leakage between tests.
@After
fun tearDown() {
clearAllMocks()
Toothpick.reset()
}
For pure logic classes (Repositories, Use Cases), use constructor injection and standard JUnit 4.
class MyRepositoryTest {
private val mockApi: MyApi = mockk(relaxed = true)
private lateinit var repository: MyRepository
@Before
fun setUp() {
repository = MyRepository(mockApi)
}
}