Turn derived test cases into a Jest, Vitest, Node, Playwright, Cypress or Testing Library file. Every case is marked todo, never silently passing.
14 cases as Vitest
All 14 marked todo, with the assertion commented out — a generated test that passes is worse than no test.
Jest provides describe, it and expect as globals, so importing them would be wrong.
Vitest requires an explicit import, unlike Jest. That is the main difference between the two snippets.
Node's built-in runner has no expect at all — these snippets use node:assert/strict, because an expect here simply would not run.
Playwright tests take a fixture object, so each case receives { page } rather than nothing.
Cypress provides its globals and uses the cy command chain rather than await.
React Testing Library renders a component and queries it the way a user would find things.
Every case is marked todo on purpose. A generated test that asserts something plausible and passes is worse than no test: the suite goes green while testing nothing, and nobody looks at a passing test again.
import { describe, expect, it } from "vitest";
/*
* Generated test cases. NONE OF THESE HAVE BEEN RUN.
*
* Each one is marked todo deliberately: a generated test that asserts
* something plausible and passes is worse than no test, because the suite
* goes green while testing nothing. Fill in the assertion, then remove the
* marker.
*/
describe("validateOrder", () => {
// Whether the field is there at all. Absent, empty and null are three different things and are handled differently by most validators.
describe("Presence", () => {
// A JSON body can send an explicit null, which is different from omitting the key. Whether the two mean the same thing is a decision that has to be made rather than discovered.
// Expect: Rejected as missing.
it.todo("quantity is null");
// const result = validateOrder({ quantity: null });
// expect(result.ok).toBe(false);
// Absent, null and empty are three different states. Most validators handle one or two of them and are surprised by the third.
// Expect: Rejected as missing, naming the field.
it.todo("quantity is absent");
// const result = validateOrder({ quantity: undefined });
// expect(result.ok).toBe(false);
});
// The values at the edges of the allowed range. Off-by-one errors live exactly here, which is why one value either side of each limit finds more defects than a hundred values in the middle.
describe("Boundary value", () => {
// The minimum is 1, so 0 is the largest invalid value. A comparison written with > instead of >= accepts it, and this is the only test that catches that.
// Expect: Rejected, with a message naming the minimum.
it.todo("quantity one below the minimum");
// const result = validateOrder({ quantity: 0 });
// expect(result.ok).toBe(false);
// The smallest valid value. A comparison written with > instead of >= rejects it, which is the same off-by-one from the other side.
// Expect: Accepted.
it.todo("quantity exactly at the minimum");
// const result = validateOrder({ quantity: 1 });
// expect(result.ok).toBe(false);
// Confirms the boundary itself was the edge rather than the whole lower range being wrong.
// Expect: Accepted.
it.todo("quantity one above the minimum");
// const result = validateOrder({ quantity: 2 });
// expect(result.ok).toBe(false);
// The last comfortably valid value, as a control for the two cases either side of the limit.
// Expect: Accepted.
it.todo("quantity one below the maximum");
// const result = validateOrder({ quantity: 99 });
// expect(result.ok).toBe(false);
// The largest valid value. A comparison written with < instead of <= rejects it, and an inclusive limit documented as exclusive is one of the commonest specification mismatches there is.
// Expect: Accepted.
it.todo("quantity exactly at the maximum");
// const result = validateOrder({ quantity: 100 });
// expect(result.ok).toBe(false);
// The smallest invalid value above the range.
// Expect: Rejected, with a message naming the maximum.
it.todo("quantity one above the maximum");
// const result = validateOrder({ quantity: 101 });
// expect(result.ok).toBe(false);
});
// One value from each class the code treats the same way. The point is economy: if every value from 2 to 98 takes the same path, testing all of them finds nothing that testing one does not.
describe("Equivalence partition", () => {
// One value standing for everything between 1 and 100. If the code treats them all the same way, testing more of them finds nothing more.
// Expect: Accepted.
it.todo("quantity in the middle of the range");
// const result = validateOrder({ quantity: 50 });
// expect(result.ok).toBe(false);
});
// The cases that are valid but unusual, and are therefore the ones nobody wrote code for.
describe("Edge case", () => {
// Zero is falsy. A validator written as `if (!value)` treats a legitimate zero as a missing value, which is the single most common validation bug in loosely typed languages.
// Expect: Rejected.
it.todo("quantity is zero");
// const result = validateOrder({ quantity: 0 });
// expect(result.ok).toBe(false);
// This is one above the largest integer a double can represent exactly, so it silently becomes 9007199254740992. Any system passing identifiers through JSON hits this, and the failure is a wrong record rather than an error.
// Expect: Rejected or handled without losing precision.
it.todo("quantity far beyond any sensible magnitude");
// const result = validateOrder({ quantity: 9007199254740993 });
// expect(result.ok).toBe(false);
});
// A value of the wrong type. What a loosely typed language does with "5" where it wanted 5 is rarely what anyone intended.
describe("Type", () => {
// Truncating silently turns a quantity of 1.5 into 1 with no error, and the person is charged for one of something they asked for more of.
// Expect: Rejected, rather than silently truncated.
it.todo("quantity as a decimal where a whole number is required");
// const result = validateOrder({ quantity: 1.5 });
// expect(result.ok).toBe(false);
// A form sends every value as a string. Whether "5" becomes 5 should be a decision in the code rather than something that happens to work, because the same looseness makes "5abc" into 5 in some languages and NaN in others.
// Expect: Either coerced deliberately or rejected — not accepted by accident.
it.todo("quantity as a numeric string");
// const result = validateOrder({ quantity: "5" });
// expect(result.ok).toBe(false);
});
// Values the field should reject, to confirm that it does and that the rejection is usable.
describe("Negative", () => {
// Confirms the rejection happens before any arithmetic, rather than producing NaN downstream.
// Expect: Rejected, with a message that does not expose internals.
it.todo("quantity as a value that is not a number at all");
// const result = validateOrder({ quantity: "abc" });
// expect(result.ok).toBe(false);
});
});Nothing in this file has been run, and the file says so at the top. Fill in each assertion and remove the marker — until then the suite will report the work as outstanding, which is the point.
Test Snippet Generator runs entirely on your device — the file is generated in your browser, nothing is executed, and nothing you enter is sent.
You’re on the Free plan. Compare plans
Having decided which cases to write, the next twenty minutes go on typing the same describe block six times with different values in it. This writes the file — in the real syntax of whichever of six frameworks you use, not a template with the name swapped.
Every generated test is marked todo, deliberately. A generated test that asserts something plausible and passes is worse than no test at all: the suite goes green while testing nothing, and nobody looks at a passing test again. The assertion is left commented out, so the suite reports work outstanding until a person fills it in.
The syntax differences matter and are respected. Jest and Cypress provide their globals, so importing them would be wrong; Vitest requires the import. Playwright tests take a fixture object. And Node's built-in runner has no expect whatsoever, so its snippets use node:assert/strict — emitting expect there would produce a file that cannot run.
Because a generated test that passes is worse than no test. The suite goes green, the work looks finished, and nobody opens a passing test again — so the case is never actually tested. Marking them todo means your test runner keeps reporting outstanding work until a person writes the assertion.
Because Node's built-in test runner has no expect. It provides describe, it and test, and assertions come from node:assert. A snippet using expect would simply throw a reference error, so the generator emits assert for that framework and expect for the others.
Because Jest injects describe, it and expect as globals and Vitest does not, unless you turn its globals option on. Importing them in Jest would be wrong; omitting them in Vitest would not run. That is the main difference between the two outputs.
Not directly. This derives cases from one field's constraints and writes them out. For whole flows — sign-in, CRUD, checkout — the scenario planner covers the common ones, and those are usually written by hand because the setup is specific to your application.
No. The generated file says so at the top, in capitals, so that nobody downstream reads a file full of test names as evidence that the tests exist and pass.
If a tool here saved you some time, you can put something towards the hosting.Buy me a coffee, on Ko-fi, opens in a new tab