Skip to content

Latest commit

 

History

History
44 lines (25 loc) · 2.17 KB

pytest_intro.md

File metadata and controls

44 lines (25 loc) · 2.17 KB

Pytest Python

Pytest is a popular Python testing framework that allows you to write single, comprehensive tests for functional, testing, XUnit, and more. Pytest's tutorial series is a series of easy-to-follow guides that help beginners understand how to use Pytest for their Python development projects. With Pytest, you can create and organize testing

Pytest is a python based testing framework, which is used to write and execute test codes. In the present days of REST services, pytest is mainly used for API testing even though we can use pytest to write simple to complex tests, i.e., we can write codes to test API, database, UI, etc.

Advantages of Pytest

The advantages of Pytest are as follows −

  • Pytest can run multiple tests in parallel, which reduces the execution time of the test suite.
  • Pytest has its own way to detect the test file and test functions automatically, if not mentioned explicitly.
  • Pytest allows us to skip a subset of the tests during execution.
  • Pytest allows us to run a subset of the entire test suite.
  • Pytest is free and open source.
  • Because of its simple syntax, pytest is very easy to start with.

1.Identifying Test files and Test Functions

2.Starting With Basic Test

3.File Execution

4.Substring Matching of Test Names

5. Grouping the Tests

6. Fixtures

7. Conftest.py

8. Parameterizing Tests

9. Xfail/Skip Tests

10. Stop Test Suite after N Test Failures

11. Run Tests in Parallel

12. Test Execution Results in XML Format

References