Framework Mode - Why assert is PyTest's core mechanism
Folder Structure of a PyTest Project
my_pytest_project/ ├── tests/ │ ├── test_example.py │ ├── test_login.py │ └── __init__.py ├── conftest.py ├── pytest.ini └── requirements.txt
my_pytest_project/ ├── tests/ │ ├── test_example.py │ ├── test_login.py │ └── __init__.py ├── conftest.py ├── pytest.ini └── requirements.txt
assert statements inside files like test_example.py.conftest.py to provide reusable setup and teardown code.pytest.ini to configure PyTest behavior.PyTest uses pytest.ini or pyproject.toml to set options like test paths, markers, and logging. Environment variables or conftest.py fixtures manage different environments and credentials. Command-line options allow selecting browsers or test groups.
PyTest generates test reports in the console by default. Plugins like pytest-html create detailed HTML reports. Integration with CI/CD tools (GitHub Actions, Jenkins) runs tests automatically and collects results. Failures are clearly shown because assert statements provide detailed error messages.
assert Statements: PyTest rewrites assert to show clear failure details without extra code.assert with @pytest.mark.parametrize to test multiple cases efficiently.In the PyTest folder structure shown, where would you add a new test file that uses assert statements to verify login functionality?