Parametrized Test
PronunciationPAIR-uh-meh-trized test
Definition
A parametrized test runs the same test logic over many sets of inputs and expected results, so you write the test once and list the cases.
Where you hear it
In pytest (@pytest.mark.parametrize), unit-testing guides, and reviews that remove copy-pasted tests.
Examples
Parametrize the test with each edge case: empty, one, many.
Each row in the table shows as its own pass or fail.
One parametrized test covers ten date formats, and each format reports its own result.
Common mistake
Packing too much into one table with cases that test different things. Group cases that share one rule.
Don't confuse with
A loop inside a test, which stops at the first failure and hides the rest. Parametrized cases report separately.
Say it at work
- In a meeting or chat
Turn these five tests into one parametrized test.
- In an email or ticket
Add another row for the leap-year case.
Keep exploring
More in Testing & Quality