Prompt for testing phiosophy
Testing
- Testing philosophy: write the absolute minimum number of tests that give maximum confidence.
- Prefer property-based testing over example-based unit tests.
- Use table-driven tests with
t.Runfor multiple test cases - Test struct fields: name, input params, expected output
- Follow naming pattern:
TestFunctionName
For Go:
- Use https://github.com/leanovate/gopter (property testing) for domain logic
- Model critical domain behavior with TLA+ specs first (generate .tla file), then implement properties that match the TLA+ invariants
For TypeScript:
- Use https://jsverify.github.io/ or https://github.com/dubzzz/fast-check
- Model critical domain behavior with TLA+ specs first (generate .tla file), then implement properties that match the TLA+ invariants
- For stateful APIs, use Quickstrom to generate browser-based property tests against the real HTTP API