This article describes how to use the Ranorex Studio IDE and the Ranorex API for test automation in your behavior-driven development (BDD) process. BDD requires a cognitive shift: instead of thinking about testing functions, you are now thinking about behaviors....
Importing, exporting, synchronizing
This subchapter explains the importing, exporting and synchronizing processes and related topics.
Before you get started, take a look at the following table to get an overview of how elements in the two programs are mapped to each other in the importing and exporting processes.
|Project with test suite||Test suite|
|Smart folder outside a test case||Section|
|Smart folder inside a test case||Step|
In this chapter
Importing allows you to import test suites from a TestRail project into a solution in Ranorex Studio.
Select Import into Ranorex Studio in the TestRail wizard and click Continue. The Import screen will appear.
To import one or more test suites:
Select the TestRail project you want to import from.
Select whether you want to import all test suites in the project or only the selected ones. If the latter, select your test suites.
Select the programming language you want your project to use in Ranorex Studio.
- You can import from all types of TestRail projects with no limitations.
- Ranorex Studio will only import TestRail cases that have the field Automation Type set to Ranorex. All other cases will be ignored.
- Ranorex Studio will recreate the structure of the TestRail project and test suite(s) for the first import only. After that, ⇢ only certain changes will be synchronized.
- Steps will not be imported.
Exporting allows you to export test suites from a Ranorex Solution to a TestRail project.
Select Export to TestRail in the TestRail wizard and click Continue. The Export screen will appear.
To export one or more test suites:
Select the TestRail project you want to export to. It can be a new or existing project. If the former, Ranorex Studio will automatically create a new project on TestRail with the name of the Ranorex solution.
Select whether you want to export all test suites in the solution or only the selected ones. If the latter, select your test suites.
- It’s not possible to export multiple Ranorex test suites to single test suite projects in TestRail (baseline included). You will need to switch the TestRail project to multiple test suites or create a new Ranorex solution with only one test suite.
- Your Ranorex solution will be created as a multiple test suite project in TestRail, with each Ranorex test suite project being recreated as a TestRail test suite.
- Ranorex Studio will recreate the structure of the Ranorex solution and test suite(s) for the first export only. After that, ⇢ only certain changes will be synchronized.
- Modules will be exported as steps.
Once you have imported from or exported to a TestRail project, the Ranorex solution is connected to it. This has the following effects:
- Connected elements (test suite, test cases/smart folders in test suites) in the solution display a TestRail icon. Test cases and smart folders will also have a link icon in their description. Double click it to go to the corresponding case in TestRail.
- The TestRail sync file is now present in the Ranorex solution.
- Synchronizing is now possible.
- Imports from/exports to any other TestRail projects are not possible. To import from/export to a different TestRail project, create a new Ranorex solution or ⇢ remove your current solution’s connection to TestRail.
The TestRail sync file – TestRail.trsd
The TestRail sync file contains all information required for the connection between the Ranorex solution and the TestRail project. It’s created after importing/exporting and stored as TestRail.trsd in the Solution Items folder of your solution. You can access it from the projects view.
Once you’ve imported or exported a test, the Synchronize button will appear in the TestRail section of the Ranorex Studio menu bar.
Click it to synchronize. Synchronizing carries out an import and an export for the currently connected test suites to update them with changes made in either program.
The following changes are synchronized
- Adding new items.
- Converting smartfoldersto test cases. A new case will be added in TestRail.
The following changes are NOT synchronized
- Deleting items. However, when you delete a test case on either side, synchronizing will remove the connection between them and the Automation Type will be set to empty in TestRail.
- Moving items.
- Renaming items.
Not synchronizing these changes makes it easier to work and collaborate between the two programs, as they serve different purposes and therefore may require different structures.
When should I use importing/exporting, when synchronizing?
Use importing/exporting when you want to
- transfer your data from one program to the other for the first time.
- add additional test suites from the same TestRail project/Ranorex solution.
Use synchronizing when you
- want already imported/exported test suites to be updated with changes made in either program.
Removing the connection to TestRail
There are several ways to remove the connection to TestRail.
- Go to Tools > TestRail integration > Remove connection to TestRail.
- Delete TestRail.trsd from the projects view.
- Delete TestRail.trsd in the solution folder in Windows Explorer.
TestRail communication error – invalid option
This error occurs when exporting or syncing if a required custom field in TestRail doesn’t have a default value set.
There are two ways to fix this.
Fix 1: Edit the custom field in TestRail
This fixes the issue for everyone using the integration with your TestRail instance. However, you will need to have rights to edit custom fields.
In TestRail, find the field and assign it a valid default value.
Repeat the export/sync in Ranorex Studio.
Fix 2: Change the value in the TestRail sync file
Alternatively, if you can’t or don’t want to edit custom fields, you can also change the value of the field in the TestRail.trsd sync file. This only fixes the problem for your machine. Others will still get the error.
In the projects view in the Solution Items folder of your solution, double-click TestRail.trsd.
Find the custom field mentioned in the error message, i.e. custom_myfield in our case.
Change its Value parameter to a valid value of the custom field.
Save your solution and repeat the export/sync option.
When repeating the export/sync, you may get a message telling you that changes were detected and to repeat the operation. You can safely ignore it.