Record Test Cases in Multiple Sessions

Add Test Cases

Click on the more icon for the test suite folder and select Add New Test Case.

For creating a test case, enter Test Case Name and Test Case Description. When the code is exported, the Description is also displayed as per the project framework structure. The reports also contain the Description details.

Add relevant tags, if required. Read more about Tags in the subsequent section.

 

Click the Add button after providing the details to create a new test case.

Tags to Test Cases: Tags help users to identify and select similar test cases while executing. For example, tags like “Regression”, “Sanity”, “Smoke” help users to identify the bunch of test cases that should be executed in a certain testing phase.

If a tag already exists, then it is populated as auto-suggestion.

When the test cases are exported, the exported source code will retain these tags in the files along with other details in the test case.

Note: Maximum 7 tags can be added to a Test Case. One tag can be a maximum of 50 characters.

Enter test case name, Description, tag(s) and click Add.

You can see the test suite and test case added to the tree.

 

Use of Tags

While executing a Test Suite, users can filter test cases on the basis of assigned tags and select test cases of a particular tag for execution.

Recording a Test Case

You can record a test case in the following environments:

  • Web

  • Mobile Web

  • Web Service

  • Android

  • iOS

  • Windows(Desktop)

Steps

  1. Open the project in which you want to record test cases.

  2. Select a test case on the tree, for which you want to record actions.

  3. Click on the Record tab, it lists down the available environments to record actions.

Record for Web

QAS allows users to record for websites for automation. Multiple Session recording was the default recording mode available until QAS v1.45 for Web and Mobile Web. In multiple session recordings, the test cases are recorded as individual test cases. You can see multiple executions running for the test cases. It is useful when the test cases are not dependent on each other. These test cases are then run either in sequence one by one (Multiple Session Execution) or simultaneously (Multiple Session Parallel Execution). Refer to Execute Recorded Test Suites for more details on execution sessions.

Note: Web test cases can be recorded in Chrome and Firefox browsers.

Steps:

  1. Open the project in which you want to record test cases.

  2. Select a test case on the tree, for which you want to record the actions.

  3. Click on the Record tab, it lists down the available environments to record actions. Select Web.

Enter the website and start recording of actions once the mentioned website is open in the browser.

Note: HTTPS protocol is mandatory for Web URL.

You can initiate the recording either on the host machine or on a remote machine.

Web Recording

  • On the Record Web window, enter the URL of the website you want to record test cases from and click Start.

Once the website opens, the recording session starts and the actions are recorded in QAS in the form of test steps. You can see the blinking icon at the top right which indicates the recording is in progress.

To stop the recording, click Stop above the grid in QAS.

 

Example: The following is an example of multiple session recording.

  • Test Suite: MultipleSession is recorded with two independent test cases

    • Test Case1: Credit Amount

    • Test Case 2: Debit Amount

Once the test case CreditAmount is created, the recording is stopped and another test case DebitAmount is created with a new recording.

 

You can -

  • edit recorded steps. Element and Input are editable.

  • add more steps to the recorded steps.

  • delete the recorded steps.

You can execute a test suite containing multiple session test cases in - Multiple and Multiple (Parallel) sessions. Read Execute Recorded Test Suites for more details.

→ When the web URL requires user authentication, simply append your credentials (username and password) with the URL.

 

The authentication pop-up is a Browser dialog window. The user will not be able to inspect the locator of that authentication popup. To handle this kind of scenario, simply append your credentials (username and password) with the URL.

For example,

  • Username= admin and Password= admin

Now enter the URL in the following format:



Export Code of Recorded Test

You can record Tests using Test Recorder and capture actions of Browser/Device and export them into runnable code.

The feature is useful when you need to upload a JSON file in Jenkins or other CI/CD tools. The file containing the source code is imported into the tool to trigger the new build.

Export Code of a Single Test Case

Test Case code can be viewed and exported through either of the following ways -

A) From the Test Case tree

B) From Test Case Detail View

A) From Test Case Tree

1. Click on the more icon for a test case and select Export.

 

 

2. A pop-up opens asking you to move all Request Calls/Locators to Object Repository/WSC file before proceeding. Click on the Proceed for Move button.

Note: Required locators should be saved to .loc file before exporting the code.

3. Select the locators/calls and then select the Repository file (loc/wsc) to which you want to move to the selected locators.

4. Click on the Move & Replace button.

5. A pop-up screen opens showing Language/Framework of the test case and its Export Location. Click on the Export button.

The next pop-up screen displays the test case and its File Path where it has been exported.

The file path shows link to open the test case code file.

6. Just click on the test case link to open the test case code file a new tab in the explorer.

B) From Test Case Detail View

1. Open the test case, the code of which you want to export.

2. To view the source code of the test case, click on the Code tab.

It displays the test case in code format in the explorer.

You can choose the language/framework you want to view the source code in. You can view the code in multiple language(s).

3. To export the source code, click on Export.

Note: The test code can be exported only in the language/framework of the project.

Then follow the rest of the points same as described for Section (A) From the Test Case Tree above.

To return to tabular view, click on View at the top right.

Export Code of a Test Suite

You can export the code of multiple test cases of a test suite at a time. 

1. Click on the more icon of the test suite the test cases code of which you want to export and select Export.

2. A pop-up opens asking you to move all Request Calls/Locators to Object Repository/WSC file before proceeding. Click on the Proceed for Move button.

If the test suite has multiple test cases, then you can view the locators/calls for each test case.

3. Select the locators/calls and then select the Repository file (loc/wsc) to which you want to move to the selected locators.

4. Click on the Move & Replace button.

5. A pop-up screen opens showing Language/Framework of the test case and its Export Location. Click on the Export button.

The next pop-up screen displays test cases and their File Path where they have been exported.

The file path shows links to open the test case code file.

Copy Test Steps

You can copy steps from one test to another in Test Recorder. You can copy the steps to test case in the same test suite or other test suite.

It is useful when steps are repeated in multiple test cases e.g. steps of Login.

Note: If the destination test case does not have any test step under it, then first add steps through recording. Then only you can paste the copied test steps in the test case.

1. Open the test case the steps of which you find applicable to other test cases as well.

2. Select test steps that you want to copy by selecting the check box.

3. Click on the Copy tab to copy the selected test steps on the clipboard.

 

4. Open the destination test case and click on the Paste tab.

5. The copied steps are pasted in the test case.

Record for Mobile Native

QAS allows users to record for mobile native applications for automation.

Pre-requisites

Steps:

  1. Open the project in which you want to record test cases.

  2. Select a test case on the tree, for which you want to record the actions.

  3. Click on the Record tab, it lists down the available environments to record actions. Select Android or iOS.

The next screen opens to provide details of Web Driver Capabilities.

Manage Capabilities

Provide input for Web Driver Capabilities.

  • Local Server: Use a local server when Appium is running on the same machine and the device is connected to the same machine.

  • Remote Server: Use a custom server when Appium is running on the remote machine and the device is connected to that remote machine.

  • SAUCELABS: You can run the QAS test scripts using Sauce Labs capabilities of your choices. Refer to Integration with Sauce Labs for more details.

  • Headspin

  • Perfecto: Users can configure Perfecto Mobile on the Web Driver Capabilities screen for recording test cases through Android. Read more details on Integration with Perfecto.

By default, the Form is displayed to enter the capabilities details. You can add more fields by clicking on Add Field.

To view the details in JSON Format, click on Switch View. Enter values for parameters.

Click Save to save the capabilities.

The saved capabilities appear at the right under Capabilities List.

Once you are done with providing web driver capabilities details for Android/iOS device -

  • start your Appium server. Refer to the article for more details on how to start Appium.

  • then click on the Start button for that device to start recording the actions that will be performed.

Modes to Record Testing Sessions

Manual Mode 

In this mode, the performance of actions does not create events. Manual efforts are required to create events.

In the following screenshot,

  1. Click on the element.

  2. The relevant locator is displayed in the drop-down above.

  3. Select Event for the locator from the drop-down and click on the Apply button.

The event is recorded in the App Source.

Interactive Mode

The interactive mode is made much faster for quick interaction with the UI to record the test.

Double click on the screen, and you can view three options available for quick actions:

A. This is a fast interaction mode for the "Click" command.

B. This is a type command.

C. More command to select other locators on the screen.

A. Click Command 

In this mode, the actions are directly recorded without manual efforts.

Only CLICK events are recorded as performed on the mobile application.

The hierarchy in the App Source panel is created accordingly.

B. Type Command

You can directly access the type command, provide the input and apply it. 

The event it recorded with the input data.

 

C. More Command

More Command helps you select other locators on the screen.

 

Click on the Refresh icon to sync the app with the simulator.

Setting the Swipe Mode

To turn the swipe mode On, click on the Swipe icon on the app UI.

Stop Recording

To stop the test recording click on the Stop icon on the app UI.

All the events are recorded in Test Recorder.

Record for Web Services

QAS allows users to record web services for automation. Web Services recording is supported in Java projects only.

Note: Before starting the Web Service Recorder, make sure you have already installed your Web Service Certification. Refer to Install Web Service Certification for more details.

Steps to record test cases for web services:

  1. Open the project in which you want to record test cases.

  2. Select a test case on the tree, for which you want to record actions.

  3. Click on the Record tab, it lists down the available environments to record actions. Select Web Service.

It opens a pop-up to enter details for QAS Recorder. Enter the following details:

  • API Base URL

Select either of the following:

(A) Record using Browser

  • Base URL

(B) Record using Proxy

Click Start to initiate the recording.

It opens the application in browser for recording through browser.

You can edit API by clicking on the following Edit icon

The next screen opens with Headers, Params and Body tabs on it.

The File parameter is added for web service automation in the tab. The option to upload a file appears as soon as you select the type File.

Click Send to view the API response in the lower section of the screen.

Add Web Service Check Points

You can add check points to the responses. The Key and its values in Headers and Body will be validated against such defined check points.

Each value row has an action icon, clicking on which shows the following options. As an alternate, you can also right click on the row.

Options for Headers:

  • Copy to Clipboard: Copy the response value on the clipboard and paste it to other places.

  • Store to: Store response header to Key and Variable.

  • Assertion: Insert assertion to headers which indicates that the response should have a specific header.

Options for Body:

In addition to the options available for Headers, one additional option is available for Body.

  • Boundary Scan: You can add check points with defined boundary values e.g., less than, greater than, equal to, contains value, etc. The Key and its values in the Body will be validated against such defined check points.

Select the condition you want to apply for Boundary Scan.

Enter Value for Boundary Scan.

Check Point Validation:

The entered value should satisfy the condition for the applied Boundary Scan, else an error will be displayed.

Check points applied to the web service response, will be added as steps and marked as passed/failed when executed.

Test Data support for Base URL in Web Service

Users can use variables from Test Data to store the Base URL value.

1. In Test Data, add URL variable with the Base URL value.

 

2. Edit the web service test case.

 

3. Replace the Base URL with the Test Data variable name in the following syntax -

${variable_name}

For example, ${URL}/orders

When the test case is executed, the variable used in the Base URL will be replaced with the test data value.