Create a Test Case
Introduction
This how-to explains how to create a test case, add test steps manually, and add test steps using the ATS Recorder. A test case consists of test steps that contain actions. Each action (like clicking a button) performs a task.
This how-to uses the Mendix Company Expenses app as an example, and you will create a test case that submits a new expense in this app. You create the same test case twice, once manually, and once with the ATS Recorder.
This how-to teaches you how to do the following:
- Create a new test case
- Add test steps to your test case manually
- Add test steps using the ATS Recorder
Prerequisites
Before starting with this how-to, make sure you have the following prerequisites in place:
- Complete How to Get Started
- Complete How to Install the ATS Helper and ATS Recorder
Creating a Test Case
To create a test case, follow these steps:
-
Open your project in ATS and go to the Repository.
-
Click Add Test inside the Tests tab:
You can also click Add Item inside the All Objects tab:
Clicking either button opens the Create new dialog box:
-
Select Test Case in the drop-down menu.
-
Enter a name in the Name field (for example, TC - 001.01 - Create new Expense (Manually)). Using a predefined naming structure is advised.
-
Enter a description in the Description field (for example, This test case creates a new expense in the company expenses app). Giving each test case a description of what it does is advised.
-
Click Create:
This will open the Test Case page. ATS displays the Name and Description in the upper-left corner of this page.
Adding Test Steps Manually
The following steps describe how to add test steps manually to your test case. You will add the steps necessary for creating a new expense in the Company Expenses app.
-
Click Add on the Test Case page:
This will open the Test Step Setup dialog box.
-
The first step is opening the Company Expenses app, which you do this by entering a URL in the browser. ATS does the same by using the open application action.
-
Enter a description of the test step in the Describe Test Step text box (for example, Open the company expenses app).
-
Search for the Open Application action in the Search Action text box. Enter terms like Find, Click, Set, Assert, and Get to find the right action.
-
Select the Open Application action from the Select an Action data grid. Choose the one for Mendix applications.
-
Click Save:
Now ATS adds the action to your test step.
-
Double-click the Application URL input parameter:
This will open the Edit Input Value dialog box.
-
Select Global Constant.
-
Select Application URL.
-
Click Save:
ATS now uses the application URL you selected in the Run Configuration application.
-
After opening the application, you must log in. ATS has a standard login action for logging in to a Mendix application that you must use, which is the login action. The login page of the company expenses app looks like this:
-
Inside your test case, click Add again and add the Login action:
-
Double-click the Username input parameter and add the username.
-
Double-click the Password input parameter and add the password:
-
After you log in to the Company Expenses app, you will see the home page. To create a new expense, you must click the New Expense button in the app. This means that ATS must click the button. To get the information you need, open the ATS Helper and hover over the New Expense button while holding Ctrl.
-
ATS has an action that clicks a widget, which is the Click Widget action. Inside your test case, click Add again and add the Click Widget action.
-
Double-click the Widget Name input parameter and add the widget name displayed in the ATS Helper:
-
After clicking New Expense in the Company Expenses app, a dialog box opens called New Expense:
-
A user visually confirms that the dialog box appears. ATS has an action that finds and asserts a dialog box, which is the Find/Assert Dialog action. Inside your test case, click Add again and add the Find/Assert Dialog action.
-
Double-click the Dialog Title input parameter and add the title of the dialog box:
-
To complete an expense, you must enter an Amount, Type, and Description, and then Save & Submit the expense:
-
The Amount field is a text box widget, the Type field is a reference selector widget, and the Description field is a text area widget. ATS can interact with all these widgets using the Set Value action. Inside your test case, click Add and add the Set Value action. Then, select the test step with the Set Value action, click Copy, and click Paste two times. Now you have a test step for each field.
-
Use the ATS Helper on the Amount field in the Company Expenses app. Select test step 5 in your test case, fill in a test step description, enter the Widget Name, and enter the Value.
-
Use the ATS Helper on the Type field in the Company Expenses app. Select test step 6 in your test case, fill in a test step description, enter the Widget Name, and enter the Value.
-
Use the ATS Helper on the Description field in the Company Expenses app. Select test step 7 in your test case, fill in a test step description, enter the Widget Name, and enter the Value.
-
To submit the new expense, you must click the Save & Submit button:
-
Inside your test case, click Add, add the Click Widget action, fill in a test step description, and enter the Widget Name:
-
You must confirm that the expense is successfully submitted. In the Company Expenses app, a submitted expense appears in the Find/Assert DataGrid Row action. Inside your test case, click Add and add the Find/Assert Datagrid Row action.
-
Now use the ATS Helper to find the Widget Name of the data grid in the Company Expenses app:
-
Also use the ATS Helper to find the Column Name of the Description column:
-
Now double-click the parameters and add the correct information:
- The Widget Name parameter and add the widget name
- The Column 1 Name parameter and enter the column name
- The Column 1 Value parameter and enter the description
-
The last step of your test case is to end your user session by logging out. ATS has two ways for logging out of your application:
- ATS clicks the Logout button
- ATS uses the Logout action The Logout action is a hard logout, meaning that no matter where ATS is inside your application, it always logs out. Inside your test case, click Add and add the Logout action.
You have added all the test steps for your test case:
-
The last thing to do is to clarify to ATS what you are testing. This is done by setting the Call Type of your test steps to one of the following:
- Setup for all the steps that you must perform to get to the test situation
- Regular for all the steps that are part of your test situation
- Teardown for all steps that are necessary to clean up
Test step 1 and test step 2 must have the Call Type: Setup. Test step 3-9 must have the Call Type: Regular. Test step 10 must have the Call Type: Teardown.
You have now manually created your test case.
Adding Test Steps Using the ATS Recorder
The following steps describe how to add test steps to your test case using the ATS Recorder. You add the steps necessary for creating a new expense in the Company Expenses app. Create a new test case by completing 3 Creating a Test Case before starting with this section.
To add test steps using the ATS Recorder, follow these steps:
-
Click Record on the Test Case page:
This opens the Recording Session page:
-
Now open a new page in your browser and enter the URL of your Mendix app. When you go back to ATS you see that ATS recorded the URL and the Open Application action:
-
Next go back to the Company Expenses app and enter your login credentials.
-
Click the New Expense button.
-
Enter an expense amount in the Amount field.
-
Enter an expense type in the Type field.
-
Enter an expense description in the Description field.
-
Click the Save & Submit button.
-
Inside the data grid, click the description in the Description column of your expense to simulate an assert:
-
Click the Sign Out button. On the Recording Session page, you see that all the steps are recorded by ATS:
-
Click Save to save the test steps into your test case:
-
You must set the input parameter Application URL of the Open Application action to the Global Constant, Application URL:
-
You must manually add the New Expense dialog box (you cannot record this). You must add the action between test step 3 and test step 4. A user will visually confirm that the dialog box appears. ATS has an action that finds and asserts a dialog box, which is the Find/Assert Dialog action. Inside your test case, click Add again and add the Find/Assert Dialog action.
Note that you can also add actions manually between recording sessions.
-
Double-click the Dialog Title input parameter and add the title of the dialog box:
-
For the logout, you can choose to keep the recorded click the Sign Out button or replace it with the Logout action.
-
The last thing to do is to clarify to ATS what you are testing. This is done by setting the Call Type of your test steps to one of the following:
- Setup for all the steps that you must perform to get to the test situation
- Regular for all the steps that are part of your test situation
- Teardown for all steps that are necessary to clean up
Test step 1 and test step 2 must have the Call Type: Setup. Test step 3-9 must have the Call Type: Regular. Test step 10 must have the Call Type: Teardown.
You have now created your test case using the ATS Recorder.
Next Up
You have now learned how to create a test case, so the next how-to is How to Create a Test Suite.
For an overview of all the how-tos and the structure, see ATS 1 How-tos. We advise following the how-tos in the order listed there.