PyTest interview questions — Medium
252 medium-level PyTest questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
PyTest appears throughout Automation Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.
1 example questions
1. Which decorator runs a pytest test multiple times with different inputs?
- A. @pytest.fixture.
- B. @pytest.mark.parametrize.correct
- C. @pytest.mark.skip.
- D. @pytest.mark.usefixtures.
Why: @pytest.mark.parametrize('arg', [..]) runs the test once per value, and pytest's assert rewriting shows rich failure details.