Vatsal Parekh

Vatsal Parekh


My thought cloud...☁

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

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 0
There are currently no comments.