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

TestRail CLI creates new empty sections in Testrail project test cases #181

Closed Jackagency closed 7 months ago

Jackagency commented 8 months ago

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

It would be great if TestRail CLI could match with the sections I've already created in TestRail and not create new empty sections every time I run it. I use TypeScript + Playwright.

Why is this feature necessary on the TestRail CLI?

At the moment, when using TypeScript + Playwright, I am unable to maintain a neat and readable set of test cases, as I am forced to either use the suggested section names such as tests/api-tests/deposit/invoiceless/test.ts, which is not very convenient and readable, or to put up with empty sections in the test case area, which significantly degrade the experience of using TestRail.

More details

Here's an example of how I had to format the empty sections because there simply was no other choice.

Снимок экрана 2023-11-08 в 5 46 03 PM

Interested in implementing it yourself?

No

bitcoder commented 7 months ago
  1. Which TR version and CLI version are you using?
  2. what type of project are you using?
  3. can you share an example of the CLI call you made?
Jackagency commented 7 months ago
  1. TR version 6.2.3.114, CLI version 1.6.1
  2. My project is TypeScritp + playwright (or clarify what you meant)
  3. trcli -y -h "https://testrail.io" --project "project" --username "username" --password "password" parse_junit -f "./test-results/junit-report.xml" --title "API Autotests Test Run" --section-id "52" --case-matcher "name" --close-run
bitcoder commented 7 months ago

Thanks for the feedback @Jackagency .

  1. On the type of project, I was referring to:

Which one are you using?

  1. "and not create new empty sections every time I run it" => can you please elaborate? Each time you import the results it creates empty sections? So, if you import it 3 times, you'll have sections with the same names 3 times? The screenshot doesn't seem to suggest that. Perhaps I didnt understand you correctly

  2. would it be possible to share the junit-report.xml you are using?

  3. In your cli usage example, --section-id "52" corresponds to the section named "Playwright sections"?

Jackagency commented 7 months ago
  1. I'm not sure that i understand it but i guess it's Single Repository

  2. I am experiencing an issue with the TestRail CLI where it is unable to locate my existing folders containing test cases. Instead, it creates new folders modeled after my automated test project. Specifically, while the CLI recognizes individual test cases by their IDs, my testing framework (Playwright) does not have an equivalent entity for sections or folders containing test cases. As a result, when generating reports, the CLI accurately places the correct test cases into the report but simultaneously creates missing folders in the test case repository. This seems to happen because the CLI cannot detect these folders, as there is no parameter in the Playwright that can change "testsuite name" in junit report.

I explained my case on TestRail youtube channel and here is the support response ""Thank you for reaching out! The CLI does not support your use case for now. Please, create an issue in GitHub so we can further improve the CLI features to meet your needs: https://github.com/gurock/trcli""

  1. I ran one test as an example for the report and removed the details and names of the cases, but the structure of the report looks like this. Снимок экрана 2023-12-05 в 6 39 02 PM

4.Yes, ID 52 corresponds to the 'Playwright sections' section. I created it to store the empty sections generated by TestRail CLI, so it doesn't clutter my project and at least keeps them in one place. It doesn't generate them anew each time; it creates a section for every test file in the project, which I don't need, as I already have manually created sections. If I add a new file to my automated test project, it generates a new section named after the file in the project. This is the problem: I can't seem to communicate to it that the section already exists, and there's no need to create new ones.

Testinator-X commented 7 months ago
  1. see also https://support.testrail.com/hc/en-us/articles/7076923860244-Projects-and-their-types#how-to-change-from-one-project-type-to-another-0-1 and https://www.testrail.com/videos/project-types for an explanation of possible TestRail project types.

—-

Btw. TestRail 6.2. is officially not supported any more. See: https://support.testrail.com/hc/en-us/articles/14334287387796-TestRail-Server-supported-versions

when diagnosing this problem, the circumstance should be considered that there might have been various API Changes with newer TestRail versions leading to this problem. e.g. https://support.testrail.com/hc/en-us/articles/17100551980564-TestRail-6-7-Default#heading-toc-4 . AFAIK the CLI Tool uses the latest API specification. But there is also no minimum required TestRail version documented in the CLI Readme, so I might be wrong.

Jackagency commented 7 months ago

I apologize, I was mistaken about my version of TestRail. I am using version 8.0.2.

Снимок экрана 2023-12-06 в 11 16 50 AM
bitcoder commented 7 months ago

Right now, the CLI will create sections based on the test suite names. In Playwright, the JUnit XML report uses the name of the source file containing the tests.

  1. Whenever you import the results, you get those sections created without any tests inside them?
  2. I think you have you tests all annotated with "Cxx", correct? If so, these tests already exist in TestRail in some suites/folders, like the "Payout", "Invoices", etc, as you have in your screenshot. Did it get it right?
  3. From my understanding, if the previous point is true, then you basically don't want the suites to be created as the test cases and the respective suites already exist, righh?
Jackagency commented 7 months ago
  1. Yes
  2. Yes. Yes
  3. Yes

It seems that I have no way of NOT creating new empty folders for cases. And the only solution I see is to put them in a separate section (like i did on the screenshot) so they at least do not clutter up my project.

bitcoder commented 7 months ago

Got it. I agree that create empty sections doesn't make sense. Let me think on a solution.