You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/skills/android-testing/SKILL.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,42 @@ description: Testing strategies for Android/KMP. Use when creating or reviewing
20
20
- Path: `src/test/java/...` espelhando o pacote do arquivo original
21
21
- Todo novo componente deve ter teste unitário cobrindo: construção, defaults, `copy()`, `equals/hashCode`, e o `craft()` do builder
22
22
23
+
## Testes gerados por IA (CI / Claude API)
24
+
25
+
O workflow de CI pode gerar testes automaticamente via Claude API. Esses testes **frequentemente falham ao compilar ou rodar** e precisam de revisão. Checklist de problemas recorrentes:
26
+
27
+
### Erros de compilação
28
+
29
+
| Problema | Sintoma | Fix |
30
+
|---|---|---|
31
+
| Code fence markdown | Arquivo começa com ` ```kotlin `| Remover ` ```kotlin ` e ` ``` ` do início/fim |
|`apply { val = }` em data class |`copy().apply { valProp = ... }`|`val` não é mutável — usar `copy(prop = ...)`|
34
+
| Enum inexistente |`CraftDAlign.START`, `CraftDTextStyle.REGULAR`| Verificar o enum real e substituir |
35
+
| AbstractMap entries incompat. | Override de `entries` com tipo errado | Remover o objeto anônimo se for código morto |
36
+
|`assertNotEquals` para ref. |`assertNotEquals(a as Any, b as Any)` quando `a == b`| Usar `assertTrue(a !== b)`|
37
+
| Type inference: `assertNotEquals`| Dois tipos diferentes sem parâmetro explícito |`assertNotEquals<Any?>(a, b)`|
38
+
39
+
### Erros de dependências em `build.gradle.kts`
40
+
41
+
Para o sourceSet `androidUnitTest` (path `src/test/java/`), garantir:
42
+
```kotlin
43
+
androidUnitTest.dependencies {
44
+
implementation(libs.junit)
45
+
implementation(libs.mockk)
46
+
implementation(kotlin("test-junit"))
47
+
}
48
+
```
49
+
50
+
### Erros de runtime
51
+
52
+
| Problema | Sintoma | Fix |
53
+
|---|---|---|
54
+
| Anotações `@Stable`/`@Immutable`/`@Serializable`|`assertTrue(isStable)` falha em runtime | Retenção BINARY — não visível via reflection. Remover o teste |
55
+
| Mock de extension function |`MockKException: Missing mocked calls` em `every { stream.bufferedReader() }`| Extension functions Kotlin precisam de `mockkStatic`. Alternativa: usar `ByteArrayInputStream`|
56
+
| Jackson `convertValue` com String |`ClassCastException` ao tentar `jsonString.convertToVO<Foo>()`|`convertValue` não parseia JSON string — remover o teste ou usar `readValue`|
57
+
| Jackson `convertValue` com List genérica | Retorna `List<LinkedHashMap>` em vez de `List<Foo>`| Genéricos apagados em runtime — remover o teste |
0 commit comments