How to add test result from unittest to testrail?

94 Views Asked by At

I have some tests with python+unittest+appium that test ios. How can I add their results to the testrail without describing how to add a result in each test?

example:

    def test_a(self):
        """test A"""
        if self.assertNotEqual(1, 1):
            api.results.add_result_for_case(run_id=self.id_test_run, case_id=123, status_id=1)
        else:
            api.results.add_result_for_case(run_id=self.id_test_run, case_id=123, status_id=5)
1

There are 1 best solutions below

0
TGavan On

Achieving this goal is most effectively done through the utilization of the TestRail CLI. The TestRail CLI serves as a command line interface tool, enabling the seamless uploading of test automation results from any JUnit-style XML file to TestRail.

By following a code-first approach, you can upload the test results based on your specified inputs. This process creates a new test run within the designated project of your choice on TestRail.

For additional information, please refer to the official documentation of the TestRail CLI by visiting the following link: https://support.testrail.com/hc/en-us/articles/12609674354068-Automation-workflows-Code-first