TestRail From Gurock is a test management solution and accessible through the Syndeia Cloud REST API. In this notebook, we demonstrate how to navigate through the multilevel TestRail data model to obtain artifact data at any level.
See the TestRail domain model description in the Syndeia Cloud Web Browser/Help/API Overview documentation for more information.
The Syndeia_Cloud_3.5_TestRail notebook illustrates request and response for several questions, drilling down through the TestRail data model to retrieve data for specified artifacts at any level.
For each section, we will identify the question being asked and what the results look like. More detail about the API method/Python code patterns used to make these queries are described in the accompanying TechNote(s).
All Syndeia documentation can be accessed most easily through the Help icon on the Syndeia Web Dashboard once Syndeia Cloud has been installed. In terms of thinking about these queries, it may be especially helpful to review the Syndeia data model under API – Overview. Intercax periodically offers on-line live training classes that provide a comprehensive review of all things Syndeia. Click here for more details.
As in the previous notebooks, the initial cells are devoted to
The results for this list are shown in Figure 1. This query was made to the Syndeia database, not the TestRail repository, but we will need a TestRail Repository Key, REPO150 in this example for TestRail @ Intercax, in our next TestRail-specific requests. For more information on the Syndeia-related Python code in this section, see the TechNote, “Queries to Syndeia Cloud Database”. Link shared below.
The cells labelled Step 3.1 asks, “What TestRail projects are contained in the TestRail @ Intercax repository?” Before this request could be passed to TestRail, the user is asked at run-time to enter their TestRail password, which is required along with their username for all requests. For the request, we used the TestRailApi class with the get_test_rail_containers() method. The results are tabulated as in Figure 2. This report shows the project names and project keys (IDs). Which will be used for later requests. For more information on the Syndeia-related Python code in this section, see the TechNote, “TestRail Authentication and Projects”. Link shared below.
In Step 4.1, we ask, "What are the Milestones in a specific TestRail project, “Unmanned Ground Vehicle”?". The results are tabulated in Figure 3, showing each artifact with name, ID, description, is_started, and is_completed Boolean values.
Step 4.1 uses the get_test_rail_artifacts() method with the optional parameters container_external_key to identify the TestRail project, type_external_key to restrict the results returned to Milestones only, page to index the pages of results returned and include_attributes to return all Milestone attribute values. It also introduces a pattern used in many of the subsequent cells to handle pagination when the number of results (e.g. Milestones) returned is large. For more information on the Syndeia-related Python code in this and following sections, see the TechNote, “Navigating TestRail Artifact Structures”. Link shared below.
In Step 4.2, the notebook searches for Test Suites in “Unmanned Ground Vehicle” using the get_test_rail_artifacts() method with the type_external_key to restrict the results returned to Suites only. Figure 4 shows the results, including description and three additional test suite attributes that were returned.
The response shown in Figure 5 for Step 4.3 digs one level deeper, using parameter other_suite set to "UGV Functional Tests". This suite’s key was retrieved in the previous section.
One more level down, the query from Step 4.4 whose response is shown in Figure 6 uses the parameters other_section set to "General" and other_suite set to "UGV Functional Tests". These keys were determined in the previous sections.
In Figure 7, we display a list of the Syndeia inter-model relations in the Syndeia container (digital thread project) “UGV” to or from the TestRail artifacts from the list displayed in Figure 6. Unlike the previous requests described in this post, this request is directed to the Syndeia Cloud database, not the TestRail repository, and it is made in the form of a Gremlin language query.
The query iterates through the list of artifacts and prints the table in Figure 7 with the relation id (Syndeia key) and the source and target artifacts. Each of the artifacts is represented by a link to the element in its native repository, Teamwork Cloud and TestRail, respectively, in this example.
The next example of the get_test_rail_artifacts() method is shown in Figure 8. The request uses the project key for “Unmanned Ground Vehicle” determined earlier and the optional parameter type = “RUN”. Test Runs record the results of testing and Syndeia has returned some of those results values for Passed_Count, Failed_Count , etc.
In Step 6.2, the notebook searches for Tests in the “UGV Functional Tests” Test Run using the get_test_rail_artifacts() method with the optional parameters other_run to identify the Run and type_external_key to restrict the results returned to Tests only. Figure 9 shows the results, including the priority and the status for the individual Tests (passed/failed/blocked/retest). The color-coding by Status of the tests was specified by the highlight() function defined in Part 1 of the notebook.
The next example of the get_test_rail_artifacts() method is shown in Figure 10. The request specifies type_external_key = “PLAN” to restrict the results returned to Test Plans only.
The next example of the get_test_rail_artifacts() method is shown in Figure 11. The request specifies a particular Test Plan by name, "Test plan for UGV Release 2", retrieves its key from results generated in the previous section and displayed in Figure 10, and uses the optional parameter other_plan.
In this Jupyter notebook, we have demonstrated how to navigate through the relatively complex data model for TestRail and obtain artifact attributes for many different artifact types.
Click here to download our Technotes.
The next set of posts in this series will use Jupyter notebooks as the primary means for demonstrating the Syndeia API and will focus on the following topics.
The notebook was created by Dr. Manas Bajaj, Chief Systems Officer at Intercax, who leads product research and development. He was a contributor to the SysML (Systems Modeling Language) 1.0 open standard and leads the SysML v2 API and Services standards development as part of the SysML v2 Submission Team (SST).