Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Success passed test in testrail when it failed #144

Open
flopberry opened this issue Feb 8, 2021 · 0 comments
Open

Success passed test in testrail when it failed #144

flopberry opened this issue Feb 8, 2021 · 0 comments

Comments

@flopberry
Copy link

flopberry commented Feb 8, 2021

        """ Collect result and associated testcases (TestRail) of an execution """
        outcome = yield
        rep = outcome.get_result()
        defectids = None
        if item.get_closest_marker(TESTRAIL_DEFECTS_PREFIX):
            defectids = item.get_closest_marker(TESTRAIL_DEFECTS_PREFIX).kwargs.get('defect_ids')
        if item.get_closest_marker(TESTRAIL_PREFIX):
            testcaseids = item.get_closest_marker(TESTRAIL_PREFIX).kwargs.get('ids')
            if rep.when == 'call' and testcaseids:
                if defectids != None:
                    self.add_result(
                        clean_test_ids(testcaseids),
                        get_test_outcome(outcome.get_result().outcome),
                        comment=rep.longrepr,
                        duration=rep.duration,
                        defects=str(clean_test_defects(defectids)).replace('[', '').replace(']', '').replace("'", '')
                    )
                else:
                    self.add_result(
                        clean_test_ids(testcaseids),
                        get_test_outcome(outcome.get_result().outcome),
                        comment=rep.longrepr,
                        duration=rep.duration
                    )

We add result only if rep.when == 'call', that mean that if we will fail test on setup or teardown, we don't get message that test failed. If test failed at setup - we don't send any message. If test failed at teardown - we send message that test passed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant