Framework Mode - Fixture as function argument
Folder Structure
project_root/
├── tests/
│ ├── test_example.py
│ └── test_login.py
├── conftest.py
└── utils/
└── helpers.py
project_root/
├── tests/
│ ├── test_example.py
│ └── test_login.py
├── conftest.py
└── utils/
└── helpers.py
conftest.py or test modules. Provide setup and teardown for tests.tests/ folder that receive fixtures as function arguments.utils/.conftest.py or separate config files.Use conftest.py to define fixtures that can be shared across tests. Manage environments and credentials using environment variables or config files loaded in fixtures.
Example: Define a fixture for a database connection that reads credentials from environment variables.
Use pytest built-in reporting with options like --junitxml=report.xml for CI systems. Integrate with CI/CD pipelines (GitHub Actions, Jenkins) to run tests automatically and collect reports.
Use plugins like pytest-html for readable HTML reports.
conftest.py for reuse and cleaner tests.function, module, session) to optimize fixture usage.Where in this folder structure would you add a new fixture that provides a web browser instance for tests?