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

Issue getting "skipped" result to post to TestRail #35

Open
jlin963 opened this issue Jan 18, 2018 · 3 comments
Open

Issue getting "skipped" result to post to TestRail #35

jlin963 opened this issue Jan 18, 2018 · 3 comments

Comments

@jlin963
Copy link

jlin963 commented Jan 18, 2018

Hi all,

I'm having issues getting a "skipped" pytest result to post to TestRail. pytest shows the status as "SKIPPED" but nothing is posted to TestRail. "Passed" and "failed" work just fine for me, but not any custom status such as "skipped".

This is the method I'm skipping:

@pytestrail.case('C1')
@pytest.mark.skip()
def test_C1():
    # test code here

In my TestRail instance, I have created a custom status with Label = Skipped, status code/id = 6, and System Name = skipped. It is marked as a final status and is an active status.
screen shot 2018-01-18 at 11 17 01 am

Since the status code is different from the one hardcoded in pytest_testrail/plugin.py (it's hardcoded to 2, which in my TestRail instance is mapped to the "blocked" status), I edited (in my fork of this project) the dictionary PYTEST_TO_TESTRAIL_STATUS in pytest_testrail/plugin.py to:

PYTEST_TO_TESTRAIL_STATUS = {
"passed": 1,
"failed": 5,
"skipped": 6,
}

I'm not getting any errors, but it's still not posting anything to TestRail. My TestRail version is 5.4.1.3668.

EDIT: did a few more tests and discovered that it works if I skip the test like this:

@pytestrail.case('C1')
def test_C1():
    pytest.skip()

...but not if I skip the test using the @pytest.mark.skip() marker.

@apallier
Copy link
Collaborator

Actually, if you use @pytest.mark.skip(), the test will be skipped at the collection stage ("before" the tests execution). It's different from executing a test and skipping it along the way with pytest.skip().
I think what you want needs a new development, maybe in pytest_collectreport(report) hook.

@allankp
Copy link
Owner

allankp commented Mar 28, 2018

Agree with @apallier this is a new development, feel free to open a PR @jlin963

zeburek added a commit to zeburek/pytest-testrail that referenced this issue Jun 3, 2018
Added verification if test marked as skipped.
If yes, and there are testcase ids (TestRail) - status is setted to "skipped".
@zeburek
Copy link
Contributor

zeburek commented Jun 3, 2018

I think, that adding support for custom statuses ids chould be done in another issue

zeburek added a commit to zeburek/pytest-testrail that referenced this issue Nov 26, 2018
Added verification if test marked as skipped.
If yes, and there are testcase ids (TestRail) - status is setted to "skipped".
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants