Vatsal Parekh

Vatsal Parekh


~☁️ My thought cloud ☁️~

December 2018
M T W T F S S
« Nov    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Categories


Powering up PyTest with Plugins

Vatsal ParekhVatsal Parekh
This post is writeup from a talk I presented at QE-CampX Pune, a Red Hat event where all the Quality Engineers and red hatters in general gather to collaborate about tools, techniques, and experiences about product quality.

Pytest is one of very good testing frameworks out there, but what makes it great is the ability to customize it for needs of your test suit.
You can almost tweak almost every stage of the test run; from gathering/generating tests, running them to reporting the results.

To do all these tweaks, ‘pytest hooks’ are the entry point. Pytest has many well-specified hooks that help you define what you want pytest to do at those certain steps.
Some basic one of them are like below ones,

pytest_runtest_setup(item)
# called before pytest_runtest_call(item).

pytest_runtest_call(item)
# called to execute the test item.

pytest_runtest_teardown(item, nextitem)
# called after pytest_runtest_call.
Comments 1