GithubHelp home page GithubHelp logo

Comments (2)

mnataraj17 avatar mnataraj17 commented on August 14, 2024 2

It's a Duplicate of #130
It would be great if someone could consider this. Lot of organizations follow this pattern of having multiple testrail cases in one Automated test in order to make tests more efficient. Thanks!

from trcli.

ssv-w32 avatar ssv-w32 commented on August 14, 2024

this could be possible solution for properties

diff --git a/trcli/readers/junit_xml.py b/trcli/readers/junit_xml.py
index 4475193..4572695 100644
--- a/trcli/readers/junit_xml.py
+++ b/trcli/readers/junit_xml.py
@@ -77,7 +77,7 @@ class JunitParser(FileParser):
                         processed_section_properties.append(prop.name)
                 for case in section:
                     cases_count += 1
-                    case_id = None
+                    multiple_ids = []
                     case_name = case.name
                     attachments = []
                     result_fields = []
@@ -90,7 +90,7 @@ class JunitParser(FileParser):
                     for case_props in case.iterchildren(Properties):
                         for prop in case_props.iterchildren(Property):
                             if prop.name and self.case_matcher == MatchersParser.PROPERTY and prop.name == "test_id":
-                                case_id = int(prop.value.lower().replace("c", ""))
+                                multiple_ids.append(int(prop.value.lower().replace("c", "")))
                             if prop.name and prop.name.startswith("testrail_attachment"):
                                 attachments.append(prop.value)
                             if prop.name and prop.name.startswith("testrail_result_field"):
@@ -109,27 +109,28 @@ class JunitParser(FileParser):
                     if error:
                         self.env.elog(error)
                         raise Exception(error)
-                    result = TestRailResult(
-                        case_id,
-                        elapsed=case.time,
-                        junit_result_unparsed=case.result,
-                        attachments=attachments,
-                        result_fields=result_fields_dict
-                    )
-                    for comment in reversed(comments):
-                        result.prepend_comment(comment)
-                    if sauce_session:
-                        result.prepend_comment(f"SauceLabs session: {sauce_session}")
-                    test_cases.append(
-                        TestRailCase(
-                            section.id,
-                            case_name,
-                            case_id,
-                            result=result,
-                            custom_automation_id=automation_id,
-                            case_fields=case_fields_dict
+                    for single_id in multiple_ids:
+                        result = TestRailResult(
+                            single_id,
+                            elapsed=case.time,
+                            junit_result_unparsed=case.result,
+                            attachments=attachments,
+                            result_fields=result_fields_dict
+                        )
+                        for comment in reversed(comments):
+                            result.prepend_comment(comment)
+                        if sauce_session:
+                            result.prepend_comment(f"SauceLabs session: {sauce_session}")
+                        test_cases.append(
+                            TestRailCase(
+                                section.id,
+                                case_name,
+                                single_id,
+                                result=result,
+                                custom_automation_id=automation_id,
+                                case_fields=case_fields_dict
+                            )
                         )
-                    )
                 test_sections.append(
                     TestRailSection(
                         section.name,

from trcli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.