Regression testing software can help you make the manual regression testing process automated. It can save a lot of time and effort. But what is regression testing software? What should you look for when you are deciding on the regression testing tool of your choice?...
Build a test
In this chapter, you’ll apply what you learned about test suites in the previous chapters. To do so, you will build a simple test using the various test suite items.
In this chapter
The screencast “build a Ranorex Studio test suite manually” walks you through the information found in this chapter.
Download the sample solution
To follow along with this tutorial, download the sample solution file from the link below.
Install the sample solution:
Unzip to any folder on your computer.
Start Ranorex Studio and open the solution file
The sample solution is available for Ranorex versions 8.0 or higher. You must agree to the automatic solution upgrade for versions 8.2 and higher.
Define the test
Before we start building our test, we need to define what it’ll do. We’re keeping it simple, so our test will only add an entry to a database and then validate whether it’s been added. Our AUT will be the Ranorex Demo Application. The required steps are:
- Start the Ranorex Demo Application.
- Click the Test database tab.
- Enter the first name in the First name field.
- Enter the last name in the Last name field.
- Select the department from the Department drop-down.
- Enter the age in the Age field.
- Select a gender from the Gender box.
- Click Add Entry.
- Validate that Number of entries has changed from 0 to 1.
- Exit the Ranorex Demo Application.
Animated test definition
Review the recording modules
Our sample solution already contains the required recording modules. Let’s take a look at them.
The modules are organized in two folders. The application functions folder contains the modules needed to control the application itself, i.e. starting and exiting the Ranorex Demo Application. The database functions folder contains the modules related to adding an entry to the database.
The modules in these folders are quite specific, as you can see from their names. They each contain only the actions necessary for an individual step in our test definition. Modules built in this way are easier to reuse. This gives you more flexibility when building tests.
Assemble the test
We’ve got everything we need, so let’s get to business and start building our test. There is one test suite in our project,
RxDatabase.rxtst. It should already be open. If it isn’t, simply double-click the file in the project view.
Add a setup region
In the test suite view, you’ll see that the test suite is mostly empty, except for a single test case with the default name. Our test definition lists starting the AUT as the first step, so that’s what we’ll add first. Starting the AUT is a perfect example of a module to include in a global setup region because, without it, no other test steps will work. To add a global setup region:
In the test suite view, right-click the test suite and click Add setup.
Adding a setup region using the context menu
From the module browser, drag the module StartAUT to the setup region. In addition to starting the demo application, the StartAUT module also clicks on the Test database tab, which is step 2 from our test definition.
Add the database test
Steps 3 to 9 in our test definition represent adding an entry to the database and validating it. This is the core of our test, so it should get its own test case. We can use the existing test case, but let’s first give it a more meaningful name.
To rename it:
Click the test case and press F2.
Rename it to SimpleDatabaseTest and press Enter.
Renaming a test case
Now we can fill the test case with the required modules. These are, in test definition order: InsertName, SelectDepartment,
To add the modules:
From the module browser, drag the modules to the test case.
- You can add them individually or select several modules at once using Ctrl + Click.
- If you misplace a module in the test suite view, simply drag it to its correct place.
Create a module group
The modules InsertName,
In the test suite view, select the four modules using Ctrl + Click or Shift + Click.
Right-click the modules; and then click Group selected modules.
The newly created module group opens in the module group view.
Creating a module group with direct grouping
Rename the module group to InsertPerson and close it.
The test case now contains the module group InsertPerson and the module group also appears in the module browser for reuse.
Add a smart folder
As tests grow larger and more complex, it can become difficult to manage the test suite. Smart folders are a useful structuring item to overcome this issue. Instead of filling a test case with 50 modules that all logically belong to the same test, add smart folders to the test case and organize the modules in them. Smart folders also make it easy to exclude particular parts of a test case from being run during test execution. This is exactly what we’re going to use a smart folder for in our example. We might not always want the validation to be carried out, so it will get its own smart folder. To add ValidateEntries to a smart folder:
Right-click the test case SimpleDatabaseTest and click Add > New smart folder.
Adding a smart folder
Drag ValidateEntries to the new smart folder.
Filling a smart folder with a recording module
Rename the smart folder to Validation.
Add a teardown region
Our test is almost complete. We only need to add the last step, exiting the Ranorex Demo Application. This is a perfect example of a step that should be in a global teardown region because, after it, no other test actions can be
In the test suite view, right-click the test suite and click Add teardown.
Adding a teardown region
From the module browser, drag the module ExitAUT to the teardown region.
Run the test
Congratulations, you’ve just built a test in the test suite. You can apply the basic principles of this tutorial to any other test you’ll create.
This is the point where you’ll run your test. We’ll cover the details and advanced options of running tests in the next chapter. For now, just press the large RUN button in the test suite view and enjoy your database test executing!