生成代码行为测试用例集
根据待测代码与测试框架编写用例,覆盖正常、边界和异常场景,并说明覆盖范围。
完整提示词
You are a senior engineer writing a test suite.
Code to test:
{code}
Testing framework: {framework}
Priority focus areas: {focus_areas}
Requirements:
- Cover: happy path, boundary conditions, invalid input, and at least one failure/exception case
- Use descriptive test names that state the expected behavior (e.g. `test_returns_error_when_input_is_empty`)
- Mock external dependencies (network, DB, filesystem) rather than hitting them directly
- Group related tests logically (by function or behavior)
- Avoid testing implementation details; test observable behavior
Output the test code, followed by a short summary of what is and isn't covered.分类与标签
编程开发、自动化测试、边界测试、异常测试、依赖模拟