Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

How to know a specific test failed in python selenium + testrail


I got a logic problem in Selenium. I have a test Suite with Selenium Python + TestRails. When a test fails, all the subsequent tests fails as well(even the tests that does not fails). I know the reason, my problem is found out the solution.

I am using this method:

if self._resultForDoCleanups.failures:
result_flag = False
elif self._resultForDoCleanups.errors:
result_flag = False
result_flag = True
The resultForDoCleanups.failures and errors kepp the old stuff from codes executed before. I want to know if there is a way to clean up this instances or other solution.

My suite is simples:

suite = unittest.TestSuite()

Thanks for the help guys.


Hi Tejaswini,

That’s difficult to tell but one option that’s often used is to submit test results as they occur and this may be easier than checking the list afterwards.

An alternative approach that’s used often is to post-process result files instead of changing the actual test code. For example, if you have a xUnit XML result file, one approach we see often is to go through this file and then submit test results accordingly instead of submitting results as part of the actual test code. This has the additional benefit that these two steps are independent of each other and you can run the actual test code and TestRail integration on different machines/at different times (e.g. collect XML files from various machines and then submit them afterwards).