🧪Assertions

Assertion is a way to test the observed results with the expected ones

Where you might need:

  • details for the failed assertions

  • passed assertions (may not be for everyone)

  • number of assertions done on a test suite/scenario

What do we show:

  • Number of Assertions passed/failed in a test suite/case

  • Expected Part of the Assertion and Observed Part of the Assertion

  • Details of the Failed Assertion (include stack trace)

To Add Passed Assertions

To save the details of the assertions passed in pytest, please add the enable_assertion_pass_hook as true in your pytest.ini file

If not done, no assertions would be saved in TestResults

Please add this in pytest.ini and this would add details for passed assertions

Reference from pytest docs.

Supported Options:

Following are the features/ways pytest provides to process assertions and how handshakes report it in db/excel

Assert that a certain exception is raised

Recommended way to write this case:

If the test passes, refer to the 'description' of the test. If it fails, the details can be found in both the description and the error field of the test case or suite. These are easily identifiable through the generated reports.

Currently, I have not observed pytest to send the details of the passed assertion, when the expected exception was raised inside the test case.

Last updated