Pytest Interview Question | QA SDET

Опубликовано: 19 Март 2026
на канале: Viplove QA - SDET
10,810
53

PyTest Cheat Sheet Summary:

PyTest is a Python testing framework for writing simple and scalable test cases. You can define tests using def test_*, run them with pytest command, use markers like skip and xfail, and leverage fixtures for setup/teardown. Parametrize tests with @pytest.mark.parametrize to run with different data sets. Use pytest -v for verbose output, -s to show print logs, and --junitxml to generate reports. Use pytest.raises to check exceptions and pytest -m to run specific markers.

PyTest Interview Q&A Summary:

PyTest is a powerful, flexible testing framework.

Skip tests using @pytest.mark.skip.

Parametrize with @pytest.mark.parametrize.

Fixtures help share setup/teardown code.

Run specific tests with pytest file.py::test_name.

Use pytest.raises for exception assertions.

Generate XML reports with --junitxml.

Use -x to stop on first fail.

Share data between tests via fixture scope.

Run tests with markers using pytest -m marker.