Bird
0
0

What is the main purpose of a conftest.py file in Selenium Python testing?

easy📝 Conceptual Q11 of 15
Selenium Python - Test Framework Integration (pytest)
What is the main purpose of a conftest.py file in Selenium Python testing?
ATo hold shared fixtures for setup and cleanup across multiple test files
BTo store test data in JSON format
CTo define Selenium WebDriver locators
DTo write test cases directly
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of conftest.py

    The conftest.py file is used to define fixtures that can be shared across multiple test files for setup and cleanup tasks.
  2. Step 2: Differentiate from other files

    It does not store test data, locators, or test cases directly but provides reusable setup code like browser initialization.
  3. Final Answer:

    To hold shared fixtures for setup and cleanup across multiple test files -> Option A
  4. Quick Check:

    conftest.py = shared fixtures [OK]
Quick Trick: Remember: conftest.py shares setup code across tests [OK]
Common Mistakes:
  • Confusing conftest.py with test case files
  • Thinking conftest.py stores test data
  • Using conftest.py to write test assertions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes