Skip to content
CodeKruPro

How parametrized tests appear in results

QuizEasy-MediumPython onlyAsked in: Accenture, Capgemini, Cognizant, Infosys, TCS
@pytest.mark.parametrize("user, ok", [("admin", True), ("guest", True), ("blocked", False)])
def test_login(user, ok): ...

How does pytest run and report this?

  • As three separate tests, each with its own result and an id built from the values, such as test_login[admin-True]
  • As one test that loops over the three rows
  • As one test per parameter name (two tests)
  • Only the first row runs unless you add -v

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in