Bird
0
0

What will be the output when running this parameterized test snippet?

medium📝 Predict Output Q13 of 15
Selenium Python - Test Framework Integration (pytest)
What will be the output when running this parameterized test snippet?
import pytest

@pytest.mark.parametrize('num, expected', [(1, 2), (2, 3), (3, 4)])
def test_increment(num, expected):
    assert num + 1 == expected
ASyntax error due to wrong decorator usage.
BAll tests fail due to assertion errors.
CAll tests pass successfully.
DOnly the first test passes, others fail.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the test logic and parameters

    Each tuple provides num and expected. The test asserts num + 1 == expected. For (1,2), 1+1=2; for (2,3), 2+1=3; for (3,4), 3+1=4.
  2. Step 2: Check if assertions hold for all cases

    All assertions are true, so all tests pass.
  3. Final Answer:

    All tests pass successfully. -> Option C
  4. Quick Check:

    num + 1 equals expected for all [OK]
Quick Trick: Check each input-output pair matches assertion [OK]
Common Mistakes:
  • Assuming some tests fail without checking values
  • Confusing parameter order
  • Thinking decorator syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes