Bird
0
0

Identify the error in the following parameterized test code:

medium📝 Debug Q14 of 15
Selenium Python - Data-Driven Testing
Identify the error in the following parameterized test code:
import pytest

@pytest.mark.parametrize('username, password')
def test_login(username, password):
    assert username != '' and password != ''
AMissing list of parameter values in @pytest.mark.parametrize decorator
BFunction parameters do not match decorator parameters
CAssertion logic is incorrect
Dpytest module is not imported
Step-by-Step Solution
Solution:
  1. Step 1: Check decorator usage

    The decorator @pytest.mark.parametrize requires two arguments: parameter names and a list of values. Here, the list of values is missing.
  2. Step 2: Verify other parts

    Function parameters match decorator names, assertion logic is valid, and pytest is imported correctly.
  3. Final Answer:

    Missing list of parameter values in @pytest.mark.parametrize decorator -> Option A
  4. Quick Check:

    Parametrize needs names and values [OK]
Quick Trick: Always provide parameter values list with parametrize [OK]
Common Mistakes:
  • Forgetting the list of test data tuples
  • Mismatching parameter names and function arguments
  • Incorrect assertion logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes