Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Writing code CodeGeeX icon CodeGeeX

Add tests: boundaries first

List boundary conditions, then give runnable test cases

22 copies / views

Prompt

Copy it whole, then replace the brackets with your own content
Handle this code task: Add tests - cover the boundaries first.

Code or error: [paste]
Environment: [language/version/framework]
Requirements: list the boundary conditions, then give runnable test cases. Give the assessment first, then the changes, then how to verify.

Replace the text in [ ] with your own situation; ask long tasks in stages.

How to get better results

Read this before you fill it in
When to use it

Legacy code needs changes but has no tests; add guardrails first, then modify.

Output requirements

Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.

Filled-in example
Add tests to this price-calculation function, covering first: 0 items, negatives, stacked discounts, decimal rounding. Use PHPUnit.
Common pitfalls

"Write some tests" yields assertions that just restate the implementation No boundaries specified, so invalid inputs are missed Not requiring runnable code, so it will not run

How to follow up

If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.

CodeGeeX icon
CodeGeeXCodeGeeX is an AI coding assistant from Zhipu, installed as an extension inside VS Code and the JetBrains family of IDEs rather than a standalone editor. At the cursor it completes code, generates whole functions, explains the selected logic, and writes comments and unit tests automatically. It also handles language-to-language conversion such as Java to Python. Personal use is free, which suits students and self-taught programmers, and teams that ask questions in Chinese and want Chinese comments. The enterprise edition supports local deployment, and a private environment has to go through the business channel. It is not aimed at deep refactors across a dozen files.
View tool

More like this: Writing code prompts · All prompts

Other prompts in this scenario