gwt-testing
SKILL.md
GWT Testing
Use these instructions to write clean, readable tests with Given/When/Then semantics.
Terminology Map
Use the agnostic terms below throughout this skill.
| Agnostic term | JS/TS example | Dart example |
|---|---|---|
| Suite block | describe |
group |
| Case block | it / test |
test |
| Setup once (for a suite) | before |
setUpAll |
| Setup each (per case) | beforeEach |
setUp |
| Teardown once (for a suite) | after |
tearDownAll |
| Teardown each (per case) | afterEach |
tearDown |
When this skill says:
- "suite block", read
describe(JS/TS) orgroup(Dart) - "case block", read
it/test(JS/TS) ortest(Dart) - "setup hook", read
before/beforeEach(JS/TS) orsetUpAll/setUp(Dart) - "teardown hook", read
after/afterEach(JS/TS) ortearDownAll/tearDown(Dart)
Rules
- Keep maximum nesting depth to 3 levels:
suite -> suite -> case. - Never nest
Givenblocks inside anotherGivenblock. - Put setup and action code in setup hooks for the scenario.
- Prefer assertion-only case blocks.
- If a
Whenhas only oneThen, use a single case title (When ... then ...); in this collapsed form, putting theWhenaction inside the case body is acceptable. - Remove wrapper describes that do not add scenario context.
- Write explicit scenario titles:
Given <subject> with <condition>.
Writing Workflow
- Define scenarios as top-level
Givensuite blocks. - Add setup hooks per scenario to arrange and act.
- Add case blocks for outcomes (
When ... then ...) with assertions only. - Keep nesting shallow and remove redundant wrappers.
- Run tests and formatter.
Pseudocode Pattern
suite("Given <subject> with <state>", () => {
setup_each(() => {
// arrange
// act
})
case("When <event> then <outcome>", () => {
// assert only
})
})
Anti-Patterns
- Nesting
GiveninsideGiven. - Calling the SUT inside a case block when it can be executed in setup hooks.
- Mixing setup/action/asserts in a single case block.
- Adding wrapper suite blocks with no new context.
- Depth greater than
suite -> suite -> case.
Review Checklist
- Are there any nested
Givenblocks? - Does each case block contain assertions only?
- Is setup/action moved into setup hooks of the relevant scenario?
- Are single
When+ singleThencases collapsed into one case block? - Is nesting depth <= 3?
Weekly Installs
3
Repository
exaby73/skillsFirst Seen
13 days ago
Security Audits
Installed on
mcpjam3
gemini-cli3
claude-code3
junie3
windsurf3
zencoder3