Test Generator
Generate comprehensive tests for the selected code or file.
Test Requirements
- •
Test Framework
- •Go: Use
testingpackage,testifyfor assertions - •Java: Use JUnit 5
- •C++: Use Google Test or Catch2
- •Go: Use
- •
Coverage
- •Test happy path scenarios
- •Test edge cases and boundary conditions
- •Test error conditions
- •Test concurrent scenarios if applicable
- •
Test Structure
- •Use table-driven tests for Go
- •Use meaningful test names (e.g.,
TestFunctionName_Scenario_ExpectedBehavior) - •Group related tests
- •Use setup/teardown where appropriate
- •
Test Quality
- •Tests should be independent and isolated
- •Use mocks/stubs for external dependencies
- •Avoid test interdependencies
- •Make tests deterministic (no random values, no time dependencies)
- •
Documentation
- •Add comments for complex test scenarios
- •Explain what is being tested and why
Output
Generate complete, runnable test code with:
- •Necessary imports
- •Test setup/teardown
- •Multiple test cases covering different scenarios
- •Clear assertions with helpful error messages