How To: Maxfail In Pytest (2 Min) | Stop Test Execution After 1 Or More Failures

preview_player
Показать описание
In this tutorial, you'll learn how to use maxfail and -x arguments in Pytest to stop test execution after one or more test failures in Python.

Example: --maxfail=2



Video Transcript:
_
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to stop test execution after one or more failures in pi. Let's start by looking at the test directory.

As you can see two of the three tests failed because the xyz keyword doesn't exist in the query output. Say you wanted to stop the test execution after the first failure. To do that click on the pi test drop down and hit edit configuration.

Now write hyphen x in the additional arguments section. Now, if you re-execute all the tests it will stop after the first test failure. Now say you wanted to stop the test execution after two failures.

To do that you would write you will write hyphen hyphen max fail equally to 2 in the additional arguments section. Now if you rerun all the tests the test execution should stop after two test failures. Finally, to export, all the test results in an HTML format hit the export test results button.

There you have it. Make sure you like, subscribe, and turn on the notification bell until next time.
Рекомендации по теме