Skip to content

Refs not updated for existing cases on junitxml record_property invocation #127

@romedtino

Description

@romedtino

TestRail CLI Version

1.4.2

CLI Environment

Mac OS Ventura 13.1, Python 3.11.1

TestRail Version

6.6.1.1166

TestRail Instance Type

Enterprise Server

Current behavior

In a pytest junitxml generated report, having property testrail_case_field value refs:REF-123 will not update the references of a case if it exists. If the case does not exist, trcli creates the test case and will contain the reference.

Desired behavior

Having property with refs should update existing cases

More Details

I currently have a very basic pytest script that uses --case-matcher property to match case IDs and if a given case exists, having record_property("testrail_case_field", "refs:PRJCT-1234") fails to add the reference to the existing case.

Sample pytest script - name to test_sample.py

def test_sample_existing(record_property):
    record_property("test_id", "C1234")
    record_property("testrail_case_field", "refs:PRJCT-1234")
    assert 5 == 5

def test_sample_not_existing(record_property):
    record_property("testrail_case_field", "refs:PRJCT-1234")
    assert 5 == 5

running with pytest --juinitxml "junit-report.xml" generates something like-

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
   <testsuite name="pytest" errors="0" failures="0" skipped="0" tests="2" time="0.034" timestamp="2023-02-16T10:09:08.765432" hostname="MYCOMPUTER">
      <testcase classname="test_tr" name="test_sample_existing" time="0.001">
         <properties>
            <property name="test_id" value="C1234" />
            <property name="testrail_case_field" value="refs:PRJCT-1234" />
         </properties>
      </testcase>
      <testcase classname="test_tr" name="test_sample_not_existing" time="0.001">
         <properties>
            <property name="testrail_case_field" value="refs:PRJCT-1234" />
         </properties>
      </testcase>
   </testsuite>
</testsuites>

Then invoking trcli with it

trcli -y -h https://mytestrail.instance.com --project "My Project" --username "username" --password "password" parse_junit --case-matcher "property" --title "My Run" -f junit-report.xml

It reports success and when I look at the TestRail site, I see it add a new testcase for test_sample_not_existing with the correct References but when I look at case C1234, the Reference value is still None. Is this expected behavior for cases that exist that you can't update refs through a test run? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions