Thursday, May 27, 2021

Pytest Framework fundamentals with sample programs

Pytest is a python based testing framework based on python. 

Pytest is mainly used to write API test cases/ database, UI testing.

What Is an Example of an API?

When you use an application on your mobile phone, the application connects to the Internet and sends data to a server. The server then retrieves that data, interprets it, performs the necessary actions, and sends it back to your phone. The application then interprets that data and presents you with the information you wanted in a readable way. This is what an API is - all of this happens via API.

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.

Ø  Running pytest without mentioning a filename will run all files of format test_*.py or *_test.py in the current directory and subdirectories. Pytest automatically identifies those files as test files