Step-by-step guide to integrate Ranorex Test Automation with Test Collab
Ranorex is easy-to-use test automation software (yet available for Windows OS only). A step-by-step wizard helps to set up the test environment and quickly get started.
For Windows application development and testing, it makes perfect sense.
Non-programmers can use the script-free drag & drop functionality, whereas professional programmers can use an API for C# and VB.NET to enhance their test suites and recordings.
It has a powerful GUI recognition covers all requirements in terms of accuracy and unique identification. It will recognize and find the element anyway even if the button’s shape or color changes. Facility to reuse code and action modules across multiple test cases with click & go functionality. This will save a lot of time when changing multiple test cases. Recording tests is very simple. Just press the record button, start your manual testing and It remembers all of the steps. Delete redundant steps with an easy-to-use editor.
So, why integrate Ranorex with Test Collab?
Three reasons primarily:
Reason #1: Connection between automated and manual testing
Many teams have a big disconnection between manual testing and automated testing. Both of these tests live in a different world. If you can keep them together, not only you improve your testing productivity but you also gain insights about your quality assurance process.
Reason #2: On-demand test execution for a selected a test case(s)
Almost every team has their automated tests tied up with their continuous integration servers, but there are times when you don’t need to run all these tests together.
Sometimes you just need to quickly test one key feature or functionality in your app.
Reason #3: Remote triggering automated test case and archiving results
What if you need to test important part of your application without setting up whole automation suite on your local PC? That’s when remote-triggering comes in.
By the end of this tutorial, anyone in your team will have easy access to run automated test case, without setting up anything on their PC.
OK, Let’s continue to installation…
Ranorex version & installation
For preparing this document Ranorex 5.4.5 version has been used.
For installation, please use the ‘setup.exe’ or self-extracting zip file ‘Ranorex-x.x.x.exe’ to start the installation, which will also install all required prerequisites.
Create solution/project in Ranorex
While creating a new Ranorex project it asks for the path where you want to generate the files along with the name of project and suite. A Ranorex suite may have one or more test cases.
Each Ranorex test case will represent a test case in Test Collab (this is how we achieve the ‘connection between manual and automated test cases).
The easiest way to create a test with Ranorex is to record a manually executed test scenario. The recorded actions like mouse clicks or keyboard actions are the base for building a robust test case.
There are different types of elements which can be used within a test suite like
- Folder – Used to group multiple test cases
- Test case – Represents a test case which can contain modules, a setup or teardown region or other test cases
- Setup region – Groups modules used to prepare a test case (e.g. start system under test, initialize a database, etc.)
- Module group – Used to group several modules into a reusable set
- Teardown region – Groups modules used to clean up a test case (e.g. deleting files generated during test execution, closing application, etc.)
- Code module – Automation module written in code
- Recording module – Automation module generated by recording
For more details, visit the following URL:
http://www.ranorex.com/support/user-guide-20/lesson-1-getting-started.html
Create test suite/case(s) in Ranorex
Before start recording, you need to ensure that your system under test is ready to start with the manual test execution. In addition, consider the following points in order to avoid too much work in cleaning up the recording and the repository afterwards.
- Do not run multiple instances of your application under test if that is not part of the test case itself.
- By default mouse movements are not recorded. For this reason please also perform a mouse click in situations like when navigating through menus.
Add [SETUP/TEARDOWN] sections for suite/test cases in Ranorex wherever required. For example, to close browser after test completion or close user session after login success.
Note: This document uses the Crowd Vox directory software which is a web appplication/CMS. We’ll test user registration and login web tests to demonstrate Ranorex integration with Test Collab for test automation.
Recording a Test and analyzing Recorded Steps
Create a new test case and add a recording module to it. Open recording module and press/click “Record” button and start manual testing by providing website URL and selecting browser for testing.
A popup will be displayed during recording process which can be used to pause/resume recording and to add validation(s) wherever required. All the actions will get recorded into Ranorex recording module as actions. After completion of manual testing, click “Stop” button on that popup.
After this review/examine the recorded actions as well as repository elements which are basically DOM elements clicked/used during manual testing. Remove unwanted actions and change actions as per requirements (if any, for example – delay, mouse clicks, key sequences, etc.).
Use variables in place of values which enables to repeat the test with different values. In addition each action item is connected to a repository item which represents a UI element (text boxes, radio buttons, buttons, etc.) used during recording. For more information on recording tests, please visit the following URL:
http://www.ranorex.com/support/user-guide-20/lesson-5-ranorex-recorder/before-starting-to-record.html
Executing the Test using Ranorex
In order to execute/test the recorded test case you need to switch back to the Ranorex test suite file. Just click on ‘Run’ button to execute the test suite with your recorded test. During the execution Ranorex simulates all user actions (mouse movements and keyboard events including delays) in order to test the application in the same way a tester would successfully do it.
Using variables in place of constants in Ranorex tests is a key to reuse/re-execute same test with different values by passing them as command parameters.
If you want to execute any particular test case at a time then select that test case and right click on it and a popup menu will be displayed. Click on “Run selected test case” menu option.
Before starting a test execution, Ranorex first compiles/build that project and inform about errors (if any). In this compilation process on the basis of the project configuration, an executable file (.exe) and other related files where generated in the bin/Debug or bin/Release directory under Ranorex project path.
After executing the test with Ranorex Studio, it automatically opens the generated test report file (*.rxlog) which shows whether the test run was successfully or not. A test is reported as failed when any validation fails or the linked UI element does not found as per action recorded during manual testing.
Note: For more information on executing Ranorex tests using command line and configuring the test automation environment using command line arguments, visit the following URL.
http://www.ranorex.com/support/user-guide-20/lesson-4-ranorex-test-suite.html
After test completion, a report will be displayed (if report is enabled in project configuration).
Deploy Ranorex test for test automation in Test Collab
The required files for executing Ranorex tests on runtime machines are located in the “bin” folder of the Ranorex installation path. These files can be found easily on machines having a valid Ranorex Installation using the environment variable %RANOREXPATH%. Please copy the whole contents of the “bin” folder (including all subdirectories) to a target folder (<TargetFolder>) on the runtime machine.
Note: It is crucial to deploy the Ranorex Assemblies with exactly the same version that was used to compile the test executable. For more information on how to deploy Ranorex tests on another machine which do not have Ranorex installed, please visit this link- http://www.ranorex.com/support/user-guide-20/xcopy-deployment.html
Ranorex generates the files needed to run automated tests in the “Output Folder” (by default <ProjectPath>\bin\Debug) of a test suite project. You can directly access this folder by right-clicking the current project and choosing “Open Output Folder” in the context menu.
It’s recommended to clear your output folder before and then trigger a new build (Build -> “Build Solution” or hot key F8).
- Required files for executing Ranorex test automation from output folder:
- Executable file (*.exe)
- Test Suite File (*.rxtst)
- Additionally required on the base of your project needs:
- Ranorex Module Group (*.rxtmg), only necessary if modules groups are in use
- Test Data (*.xlsx, *.xlsb, *.xls, *.csv, *), only necessary for data driven tests and if data source files were added to project
- Module Libraries (*.dll), only necessary if module libraries are linked and embedded functionality is referenced in the Test Suite
- Sub folder “RepositoryImages” including all files, if exists
Finally copy all the files needed to the target machine and place them in the folder where all Ranorex Libraries and Assemblies are already located (<TargetFolder>). Of course, by copying the whole output folder (“bin\debug” by default), you will ensure you have everything possibly required for running your test.
In short, it is best to copy the complete output folder (e.g. ‘bin/debug’) to the target machine.
Enable test automation and create remote executor in Test Collab
Log in to your Test Collab instance with an administrator user account and open “General Settings” page. On this page mark the checkbox as selected saying “Enable Test Automation” and save.
After that, refresh the page and a new tab/option “Remote Executors” will be displayed under “Settings” menu. Add remote executors as per your requirement.
Remote executor in Test Collab is simply a machine where your automated test runs.
Next step: Adding a remote executor
To add a machine with remote executor to Test Collab: You can do it From Settings ->Remote Executors. Adding remote executor will need following information:
- Machine name: This is the name which will represent machine in the application.
- Machine API Key: This can be any random series of alphabets that will be used for authentication of remote executor. This field should be unique for each remote executor.
Project wise test automation settings
Login to your Test Collab instance with an administrator user account and select the project for which test automation settings has to be done. Click on “Settings” menu and then select “Automation Settings” option under it. Enter values for the following fields and save automation settings.
- Base Dir – Full path to the directory on remote machine where automated test cases has to be executed by remote executor program. In this case, it will be a target folder in which Ranorex test executable file along with other required files generated using build project and Ranorex installation folder bin files exists.
- Command template to execute individual test case – Command to be executed to perform automated test execution using Ranorex. In the following example
C:\tcm_test\crowdvox\cv.exe /tc:[[ranorex_test_case_name]] /rf:report.rxlog
Let’s break it down:
cv.exe is a Ranorex executable file (generated using build project option in Ranorex) which will trigger our automation
/tc (to specify which test case to execute – [[ranorex_test_case_name]] will be replaced with the value saved in Test Collab test cases for automation) and
/rf (to specify report file name other then default report file name which will be generated during automated test run). Arguments should be enclosed within 2 capital brackets for example [[ranorex_test_case_name]]. - Command Parameters – Arguments (if any) which are entered in Command template, has to be entered here by separating each of them with a new line. For these parameters, values will be entered for each test case and will be used in test automation process.
- File(s) to collect after test execution – These are the files which will be looked for, and archived after automation runs.
New line separated list of files with full path (if any) which has to be collected from remote machine. In this case, there will be 2 files which are Ranorex report files (report.rxlog and report.rxlog.data) which will provide information about test result executed automatically by remote executor.
Automate test cases
After saving project wise test automation settings, we need to provide the values for command parameters (if any) for each test case in Test Collab. Open the Test cases list page and select the test case(s) which needs to automate. A new action link “Automate” will be displayed on test case view along with other actions (like Duplicate/Edit/Delete – based on user rights).
On test case automation params page, provide the desired values for command parameters as per automation testing requirements and save the data.
For example, “Login” and “Register” are entered as test case automation params which will be used to execute a particular ranorex test case during test automation for that execution case. In this way, we can add as many test cases in a single Ranorex Suite/Project and use them as per requirement.
OK, Now it’s time to trigger these tests remotely…
Create test execution in Test Collab
Create a new test execution in Test Collab as per requirements and select test suites/cases for that execution and assign them to Remote Executor to automate the test execution. For more details on test execution/plan, please visit the following URL.
http://support.testcollab.com/test-executions-and-plans/how-to-create-a-test-execution
After assigning test cases to remote executor, click on “Save” button to complete the execution assign process.
Once a test execution has been assigned to a remote executor, the remote executor fetches the execution case information from Test Collab along with automation parameters values/settings for that test execution case and starts the execution of Ranorex executable and providing the parameters to it (if any).
Image-1 showing automated execution of test cases using Ranorex on remote machine by Test Collab remote executor.
Image-2: Automation running in progress
After completion of Ranorex test execution, the remote executor program collects the result and passes it back to Test Collab server along with the requested data (like report file or any other file generated during test execution) and on Test Collab server that particular execution case status will be set as pass/fail according to the information provided by remote executor.
Detailed Execution view after completion of automated test run
Execution case individual view
Automation result
On this page, in “Logs” section, the output during automated test execution using Ranorex suite/project executable is being displayed (green text) along with the test result (Pass).
Automation result with attchments and other details
At the end of the “Logs” section, other information related with the execution will be displayed like execution start/end time and total time taken in that particular execution run along with the attached files generated during automated execution process (report.rxlog and report.rxlog.data files).
Key takeaways:
1. Connect your manual and automated testing together at one place for better control.
2. Automated test cases isn’t just for developers to trigger or advanced testers, give power to your whole team by enabling remote control.
3. Have granular control over automation. Enable your team to run one single test case if needed without having to run whole build.
I hope you like this tutorial. Like we integrated Ranorex with Test Collab here, any test automation tool can be integrated as long as it supports command line. What would you like to learn next? Scaling test automation, Integration with Selenium, Google’s latest EarlGrey, context-driven testing with Test Collab… Let me know.