Test Case Generator
Fill in the details below
Your output will appear here.
Our test case generator drafts test cases for a single function. You describe its signature, behavior, valid inputs, edge cases, error handling, coverage criteria and constraints, and AI suggests cases with inputs and expected results. It suits developers and QA testers who want a fast first list to refine. The cases are generated with AI, so review and run them. It is free with no sign-up.
Fill in the details below
Your output will appear here.
Signature, behavior, valid ranges, data types, edge cases, invalid input handling, coverage criteria and constraints guide the draft.
List special cases and invalid input rules so the draft covers boundaries and errors, not only the happy path.
Name the coverage criteria you need, such as branch coverage, and the draft aims its cases at them.
Copy the cases into your test framework or test management tool, then run and adjust them.
Three steps from a blank form to a result you can use.
Enter the function name, parameters and return type, then explain what it should do in plain words.
Fill in valid ranges, data types, edge cases, invalid input handling, coverage criteria and any constraints.
Click Generate, copy the cases and check each expected result against the specification before you run them.
A test case states an input, the conditions around it and the result you expect. Good sets cover normal values, the edges of each valid range and the inputs the function must reject.
The form has eight fields. The more of them you fill in, the more targeted the draft.
applyDiscount(price: float, percent: int) -> float.Click Generate, read the draft in the output panel and click Copy when you are happy with it.
Two classic techniques decide most of the inputs a good test set needs. Naming them in the coverage field tells the AI what you expect.
The standard example is a month field that accepts 1 to 12. Equivalence partitioning gives three groups: 0 and below, 1 to 12, and 13 and above, so 0, 6 and 13 cover them. Boundary value analysis adds 0, 1, 12 and 13. Together that is five distinct values (0, 1, 6, 12 and 13), aimed at the off by one mistakes that range checks invite.
The coverage field accepts any target you write. These are the common ones, defined as in the standard code coverage literature.
| Criterion | Question it answers |
|---|---|
| Function coverage | Has each function in the program been called? |
| Statement coverage | Has each statement in the program been executed? |
| Branch coverage | Has every edge in the control flow been executed, such as both the true and false path of an if? |
| Condition coverage | Has each Boolean sub expression evaluated both to true and false? |
Statement coverage alone can mislead. For a function that checks if ((x > 0) && (y > 0)), the call foo(1,1) runs every statement, but branch coverage also needs foo(0,1) to take the false path. We suggest asking for branch coverage at minimum.
Example: an illustration with a made up function. The tool's real output will differ in format and wording.
Inputs: the signature is applyDiscount(price: float, percent: int) -> float. Behavior: returns the price after the percent discount. Valid range: price 0 or more, percent 0 to 100. Invalid inputs: throw an error. Coverage: every boundary on both sides. Constraint: round to two decimals.
A useful set of cases checks out like this. We worked out each expected result by hand: 80 minus 25% is 80 times 0.75, which is 60.
| ID | Input | Expected result | Why |
|---|---|---|---|
| TC1 | price 80, percent 25 | 60.00 | Normal value |
| TC2 | price 80, percent 0 | 80.00 | Lower boundary |
| TC3 | price 80, percent 100 | 0.00 | Upper boundary |
| TC4 | price 80, percent minus 1 | Error | Just below range |
| TC5 | price 80, percent 101 | Error | Just above range |
| TC6 | price 0, percent 50 | 0.00 | Zero price |
| TC7 | price minus 0.01, percent 10 | Error | Negative price |
| TC8 | price 19.99, percent 15 | 16.99 | Rounding: 19.99 times 0.85 is 16.9915 |
TC8 is the kind of case drafts often miss or get wrong. Your rounding rule decides whether 16.9915 becomes 16.99, so check the expected value yourself.
Treat the draft as a checklist to start from. Add the cases you know matter for your users, delete duplicates and keep the final set with the code. If you track testing work in Onethread, each failed case can become a task with its input and expected result attached.
Quick answers about the Test Case Generator.
It drafts test cases for one function from eight fields: signature, behavior, valid input range, data types, edge cases, invalid input handling, coverage criteria and constraints. AI writes cases with inputs and expected results into the output panel. You copy them, check each expected result and add them to your tests.
Yes. The tool is free and needs no sign-up or account. Fill in as many of the eight fields as you can, click Generate and copy the result. There is no download step, so paste the cases into your test framework, spreadsheet or test management tool and keep editing there.
Use them as a starting point. The AI can propose useful edge cases quickly, but expected results may be wrong and rules missing from your description may be guessed. Recalculate every expected value from the specification, run the cases in your framework and keep only the ones that test real requirements.
A test scenario is a broad situation to check, such as applying a discount at checkout. A test case is one specific check inside it, with an exact input and an expected result, such as price 80 and 25 percent giving 60. This tool drafts test cases for a single function.
The tool drafts test cases from your description. If you want them as code for a framework such as PHPUnit, Jest or pytest, say so in the constraints field. Check that any generated test code matches your framework version, then run it and confirm each assertion fails when the function is broken.
The behavior description, the valid input range and the invalid input handling field matter most. They tell the AI what correct looks like, where the boundaries sit and what must be rejected. Without them, the draft falls back to happy path checks and may guess how errors should behave.
This function name generator suggests clear names for a function from a plain description of what it does.
Our PHP code generator drafts PHP code from a short brief.
Our website typography generator suggests fonts and font sizes for your site, with a short explanation for...
Our JavaScript generator writes JavaScript code from a plain description of your project.