4.4 Creating test case by recording (Web & Mobile)
Quick Start Screencast
Automated Test Case
Automated Test Case allows you to create a Test Case by adding test steps (keywords, FLs, or SR methods) manually, mapping them with OR objects (if required), etc. Here, you can also create a Test Case by recording flows of actions using application-specific Recorder, performed on the particular application during the recording session, and do much more with the test cases.
Overview:
Creating a Test case by recording is one of the most well-known features OpKey which helps you to record actions performed over the web application and create a Test case in a hassle free way.
- Select a folder from the project workspace and create a new test case file.
- Go to the toolbar section and click on the ‘Record’ button which provides three options: Web Recorder, Mobile Recorder, Desktop Recorder, Oracle Recorder, Salesforce Recorder & Workday Recorder.
- To perform recording on the web applications you need to select Web Recorder
- To perform recording on the Mobile applications you need to select Mobile Recorder
- To perform recording on the Desktop applications you need to select Desktop Recorder
- To perform recording on the Oracle applications you need to select Oracle Recorder
- To perform recording on the Salesforce applications you need to select Salesforce Recorder
- To perform recording on the Workday applications you need to select Workday Recorder
- To perform recording on the iOS applications you need to select iOS Recorder
Here you can view the list of available OpKey Recorders:
Let us first start with the Web Recorder…
4.2.1 Recording on Web Applications:
When you click on ‘Web Recorder’, Web Recorder page opens.
There are two steps to be followed to start recording on a web application.
Step 1: Select Object Repository (Default Object Repository or Choose Object Repository)
Step 2: Select your Browser (Chrome AddOn or Smart Recorder)
Let us choose the Smart Recorder here.
An alert message pop up appears which asks you to keep OpKey Recorder jnlp file. Click on Keep to proceed the recording process.
Jnlp file gets downloaded every time and detects OpKey Smart Recorder, if it is installed on your machine then you are redirected for recording and if not installed then it redirects you to install the OpKey Smart Recorder.
If the user invokes the recorder (OpKey Smart Recorder) on local machine before starting recording, then the process of downloading JNLP file will be skipped and user will directly be redirected to OR Selector window.
For further details, please refer installing OpKey Smart Recorder
While working with OpKey Web on Mozilla Firefox and using OpKey Smart Recorder for the first time, you will need to install the OpKey certificate on Mozilla Firefox manually (Please refer: Installing OpKey Certificate on Mozilla Firefox)
Java Runtime Environment (JRE) needs to be installed on your system to run jnlp successfully.
Further, your application gets downloaded.
Once downloading gets completed, your application gets verified.
A dialog box will open where you can create new or select an existing OR file. Select your folder and click on the Create New File icon. Choose the desired browser on which you want to perform your recording operation.
Web Recorder home page opens as shown below:
Getting Familiar with buttons/icons used while recording:
Now, you can perform your recording by clicking over the desired object on web application. Fetched object properties are shown in the bottom pane.
Objects fetched while recording, are shown in left upper pane with their name and the properties of recorded objects are shown in left bottom pane.
While performing recording operation, you can switch to a new browser by closing the current browser. To switch to a new browser, click on desired browser icon. A pop up message box will be displayed for closing current browser and opening new one. Click on OK to proceed.
In addition, you can also navigate to a new URL. For this, enter the desired URL in the URL bar and click on Navigate. The entered URL will open in your browser as well.
Once the recording process gets completed, click on the Stop button. The browser will be closed, and you will be prompted to save and close the recorder
An alternative way of starting the recording session is to right-click on the test case steps. When you right-click here, you get various options to perform actions like copy, paste, add step, delete, etc. along with ‘Record’ option for recording on the desired web application.
Right-click on the Test steps provides you with various options, as shown in the below screenshot. You can perform tasks corresponding to each option displayed on right-click as well.
Once the objects get saved, you can see all the test steps, corresponding to your recording, on the Test case main window as shown below.
Spy mode of Recorder:
Spy is an advanced feature of the recorder which enables you to helps you observe page hierarchy and object property before working on it. This feature is very useful in case you have forgotten to fetch an object while performing recording. While fetching objects in Spy mode, keep holding the Ctrl key and hover the mouse over the desired object. Properties of the spied object get fetched and displayed in the bottom pane of the recorder window.
Hold ‘Ctrl’ button & Hover mouse on desired object > ‘Object properties’ are fetched
Click on ‘Highlight’ button > Targeted object highlighted within red square
Click on ‘Click’ button > Target object is clicked
In the above given images, the first image shows Spy feature home page without any object and the second images shows details about the properties of fetched object.
Now, the fetched object can be added directly to the step or to OR. If you want to add it to the step then click on Add Step button by choosing action from the drop down list. When you use Add Step button then this fetched object will be added within the current recording session only. Another way to use the fetched object is Add to OR. By using this button, you can directly add this fetched object to the corresponding OR which can be used as per your need, not only within this session but also with other sessions as well.
With the help of Relational APIs, you can find out the relation between the ‘Set Pivot’ object and the mouse hovered object. This relation describes the object location whether it’s nearby (leftOf, rightOf, belowOf and aboveOf) or within div (in).
Now, you can find out the dynamic object by setting pivot to any nearby static object. While recording on a web application having static & dynamic objects both, you first need to identify a static object. Hold the Ctrl key and hover your mouse over the static object to fetch properties.
For example if we suppose the Home object is static whereas the Company object is dynamic then we first need to fetch the Home object properties by using Spy mode.
Now, check ‘Set Pivot’ checkbox.
Hold Ctrl key and hover the mouse over the dynamic objects (For example Company) to fetch the current properties. Now, you can scroll down to see details about the fetched properties of this object along with its current location with reference to the static object (Set Pivot).
The Company object is existing at right side of the Home object.
“Set Pivot” feature of Spy Recorder is very helpful for recording objects having dynamic properties. By using this feature, you can handle such situations easily.
4.2.2 Recording on Mobile device
One of the advanced features of OpKey is Recording on Mobile device which is similar to the Web recording. While doing this, you just need to follow few simple steps as described below:
Create a Test Case file & open it > Click on the “Record” button > Click on “Mobile Recorder”
(A) Recording on Mobile devices over pCloudy:
In the next step of mobile recording, you need to select the ‘Object Repository’ File where fetched objects will be saved. You can perform recording over pCloudy or locally connected device as shown in the image below. (Here, we are performing recording over pCloudy.)
In order to access pCloudy devices, you must be a registered user of pCloudy along with enough credits for testing.
Enter all required credentials over pCloudy dashboard and click on ‘Log In’ as shown below:
Further, you need to select your android application from the dropdown list and device from the device list. Click on ‘Finish’ to proceed.
Enter your pCloudy account credentials to login and start testing.
The app is getting installed on the selected pCloudy device.
The Mobile recording page opens as shown below. The left window shows the recorded objects and their properties etc. The right window shows connected device information.
Click on objects shown on the mobile screen to fetch their properties.
Once recording process gets completed successfully, click on the ‘Stop & Save’ button. A confirmation notification appears. Click on ‘Save’.
You can see the Test Case file created, based on your recording actions over the mobile device. Now, you can execute your newly made Test Case and analyze execution results.
(B) Recording on Locally connected Mobile devices:
OpKey allows you to perform recording over locally connected mobile devices as well. But, you must register your locally device(s) before starting recording process.
Go to the “Tools” menu > Mobile Management > Device Management > Select your running Execution Agent > Click on “Register” icon for selected device.
Let us proceed to the recording over locally connected device…
Create a Test Case file > Click to the “Recorder” button > Select Mobile Recorder
Create or select your OR file to store all recorded objects > Click on “Local” button to start recording on your connected device.
Select your Local running Execution Agent > Select connected Mobile device > Select your Mobile Application
Now, you can see that your selected application opens on the connected device. It lets you tap or type on the desired object which has to be recorded.
Here, you can see the list of actions performed while recording along with objects and their properties.
Click on the “Stop and Save” button to save recorded test steps to your test case.
You can see the Test Case file created by recording actions performed on mobile. You can now playback this recorded test case and analyze your execution result as well.
(C) Recording on iOS devices over pCloudy:
- Mobile Recorder window opens. From here, you need to select/create an Object Repository file to proceed recording on a pCloudy device.
- Click Next to continue.
- pCloudy Dashboard page opens. Enter API Endpoint, API User Name & API Access Key & click on Login.
- From here, select an iOS Application, iOS version, corresponding iOS device, enter duration & click on Start Recording.
- Mobile Recorder page opens. Start working on your iOS application on iOS device.
- You can see that the actions being performed on the application has been recorded one by one along with their object properties.
- The Test Case has been created automatically. You can have a look below.
Search Added Test Step:
While working with Test Case and Function Library artifact having few test step(s), you can search the added Test Step from the list of keyword library. You don’t need to browse and search for location of the particular Test Step from Add Keyword tab.
4.2.3 Image-based recording and playback on mobile
OpKey Web allows you to perform image-based recording and playback on the mobile device. Before starting image-based recording, make sure that your mobile device is correctly connected and registered on your machine. In addition, OpKey Smart recorder is installed on your machine which is required for recording.
Follow below-given steps:
- Launch OpKey Smart Recorder.
- Open OpKey Web, create a Test Case and open it.
- Click on the Mobile Recorder of Recorder button.
- Select/Create OR file to store objects to be recorded.
- Local Mobile Recorder window opens as follows. Select your Execution Agent, Mobile device and Mobile app and then click on Complete to proceed.
- The next step will take few moments to download and install app on connected mobile device.
- Once, it has completed, you come to the Recorder window as shown below. Click on Capture image to create new object button.
- Crop the image to be captured. You can see that the object has been fetched. Add corresponding action keyword to the captured step. Follow this step to capture all required images one by one.
- If you want to change the captured image then you can use Capture image to add into the existing object
Once, recording has finished, click on “Stop & Save” button to stop and save the recorded steps and objects. Now you can see the created Test Case by performing image based recording.
Now, go to the created OR file. Properties contain only one value as URL.
Let us add two new properties by clicking Add Property button. You need to add Height and Width properties by providing their values which depends on the resolution of device on which recording has performed. Check IsUsed checkbox for both newly added properties. Click Save to save added properties.
Further, you can execute your Test Case by using the “Run Now” button for playback of the recorded steps by using OpKey Mobility Plugin.
4.2.4 Image-based recording on the web
While working on OpKey Web, the user can perform image-based web recording. To do so, follow the steps given below:
- Create a Test Case and Click to Open it.
- Click Record Button and select the Web Recorder.
- Your Recorder page will get open. Click on the desired browser icon (Google Chrome, Mozilla Firefox or Internet Explorer).
- Type the URL of your web application.
- Click on Capture image to create a new object button. An image type object gets automatically added to the Recorder window.
- Crop the image. The Image gets captured and added to the Value of the Object attribute. Go to Action cell, add corresponding action (Keyword) to be performed on captured object.
- In this way, you can capture all required image objects one by one. You can also change/update any captured image by using Capture image to add into the existing object button.
- Once all the images are being captured, you need to add corresponding action (Keyword) with the captured images as shown below:
- Now, click on Stop & Save button to stop and save fetched image objects.
- Here, you can see that the Test Case has been created through image based recording on web.
- Click Save.
- Click Run Now to execute the Test Case by using Visual as Generic Plugin in Execution Wizard.