gurock / trcli

TR CLI (trcli) is a command line tool for interacting with TestRail.
Mozilla Public License 2.0
48 stars 39 forks source link

Support for sorting by test status when you have more than one test result being added to a single Test Case #235

Open cbattaglia opened 3 weeks ago

cbattaglia commented 3 weeks ago

What would you like the TestRail CLI to be able to do?

When parsing the results of the test report I would like to be able to specify a way to sort the way the results are posted to TestRail.

Why is this feature necessary on the TestRail CLI?

Currently the results are posted in the way they are read in as is. This causes some issues when a Failed result is posted before a Pass resulting in TestRail marking the Test Case as passed.

Example Test Class:

public class SimpleTest1 {
    @Test
    @TestRail(id = "Cxxx1")
    void testOne() {  }

    @Test
    @TestRail(id = "Cxxx1")
    void testTwo() {  }

    @Test
    @TestRail(id = "Cxxx2")
    void testThree() { }

    @Test
    @TestRail(id = "Cxxx2")
    void testFour() { }
}

Example Report:

<testcase>
   <properties>
      <property name="test_id" value="Cxxx1"/>
   </properties>
</testcase>
<testcase>
   <failure message="some message"></failure>
   <properties>
      <property name="test_id" value="Cxxx1"/>
   </properties>
</testcase>
<testcase>
   <failure message="some message"></failure>
   <properties>
      <property name="test_id" value="Cxxx2"/>
   </properties>
</testcase>
<testcase>
   <properties>
      <property name="test_id" value="Cxxx2"/>
   </properties>
</testcase>

The results in TestRail will show Cxxx1 Failing but Cxxx2 Passing

More details

I'm focusing primarily on Passes and Failures but others may care about other statuses being the priority for TestRail to mark a Test Case as.

Interested in implementing it yourself?

Yes