Bird
0
0

Which decorator is used in pytest to parameterize a test function?

easy📝 Conceptual Q2 of 15
Selenium Python - Data-Driven Testing
Which decorator is used in pytest to parameterize a test function?
A@pytest.mark.parametrize
B@pytest.data
C@pytest.testdata
D@pytest.parameter
Step-by-Step Solution
Solution:
  1. Step 1: Recall pytest parameterization syntax

    Pytest uses the decorator @pytest.mark.parametrize to pass multiple data sets.
  2. Step 2: Verify other options

    Other options are not valid pytest decorators for parameterization.
  3. Final Answer:

    @pytest.mark.parametrize -> Option A
  4. Quick Check:

    Pytest parameterize decorator = @pytest.mark.parametrize [OK]
Quick Trick: Use @pytest.mark.parametrize to pass test data [OK]
Common Mistakes:
  • Using incorrect decorator names
  • Confusing with other pytest plugins
  • Missing the 'mark' part in the decorator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes