Assign IDs to Pytest Parametrize

Assign IDs to Pytest Parametrize

When using pytest parametrize, it can be difficult to understand the role of each test case. You can add the ids parameter to pytest parametrize to assign names to test cases.

In the code above, the first test case is shown as neg-neg instead of [-1--2]. This makes it easier for others to understand the roles of your test cases.

My previous tips on testing in Python.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran