Bird
0
0

Which of the following is a valid way to provide IDs in @pytest.mark.parametrize?

easy🧠 Conceptual Q2 of 15
PyTest - Parametrize
Which of the following is a valid way to provide IDs in @pytest.mark.parametrize?
Alabels=[1, 2]
Bid=("case1", "case2")
Cids=["case1", "case2"]
Dnames={"case1", "case2"}
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct syntax for IDs

    The ids parameter expects a list or iterable of strings naming each test case.
  2. Step 2: Match options to syntax

    Only ids=["case1", "case2"] uses ids=[...] correctly; others use wrong keywords or types.
  3. Final Answer:

    ids=["case1", "case2"] -> Option C
  4. Quick Check:

    Correct parametrize IDs syntax = ids=[...] [OK]
Quick Trick: Use 'ids' keyword with a list of strings [OK]
Common Mistakes:
MISTAKES
  • Using 'id' instead of 'ids'
  • Using sets {} instead of lists []
  • Using unrelated keywords like 'names' or 'labels'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes