Hi, over the next 10 minutes you will be introduced to Test automation awesomeness by using Opkey. This tutorial will help you create your first automation script, organize it according to automation best practices, data drive with dynamic data, and execute it on multiple browsers — All in less than 10 minutes!
By using Opkey – Test Automation Platform, you can easily automate your test case without writing even a single line of code. With Opkey, test cases can be recorded, manually created or scripted and used for automated playback and error logging.
So, let’s get started without wasting time further!
- Go to the Opkey-Web page and login with your user credentials.
- After successful login, select the Project to work on that.
- Go to the left pane of the dashboard screen, and create a new folder to organize all your automation artifacts.
Make sure that JRE (version 1.8 or above) and Opkey Smart Recorder is installed on your machine. For more details, refer Opkey Smart Recorder installation.
Workflow for automating your first Test Case within 10 Minutes
- Select a folder and then click on the Create New File button and then select Test Case.
- Open your Test Case to add test steps. Here, you can add test steps by clicking on the Add Test Step button and adding the respective keywords. Alternatively, the test case can be easily created by recording your actions performed over the web application. But before that, you would need to install Opkey Smart Recorder on the machine.
Getting started with recording:
- Now, you can start recording with Opkey Smart Recorder on the latest web browsers (Google Chrome, Mozilla Firefox, and Internet Explorer)
- Click on the Record button and select the Web Recorder.
- Here are two ways to record actions performed on the web application: Using Smart Recorder and using Chrome Addon.
Let us first see how to use the Smart Recorder and Chrome Addon one by one.
Recording using Smart Recorder
- Web Recorder window opens from where you can choose Object Repository and Recorder (Chrome AdOn or Smart Recorder)
- Select or create an Object Repository file and then select Smart Recorder & Browser to start recording session.
- It detects Java & Opkey Smart Recorder whether they are installed on your machine or not. If Smart Recorder is installed on your machine then you just need to click on the Open Start popup and launch the smart recorder. If Smart Recorder is not installed in your machine then you are redirected to install it first.
- Click Start Recording to initiate a recording session.
- Click on objects of web application to record actions along with their properties.
- Below given image shows the recorded properties of actions performed on web application.
- Click on Add Row button to add a new row in the property list.
- You can use Delete Row to delete the selected step from the list.
- You can also switch to any other browser by clicking over the given browser at the top. Navigate button allows you to open the desired URL on the browser for recording.
Once the recording process has been completed, stop the recording process by clicking on the Stop & Save button. It asks you to save recorded objects and close the recorder. Click on Save to proceed.
There are two advanced features of recording: Record & Spy. Record is the default recording mode that allows you to record & fetch properties of the desired object by clicking over the object. While using the Spy feature, press the Ctrl button of keyboard and mouse hover on the object to record all the properties to the current step within OR for future use.
- Once the recording process has been completed, stop the recording process by clicking on Stop & Save button. It asks you to save recorded objects and close the recorder. Click on Save to proceed.
Once, you have saved your recorded test steps, you can go through your newly created test case script as shown below:
Recording using Chrome Addon
Opkey Recorder for Chrome is a Chrome Extension used for recording flows from Salesforce, Workday, and other web applications. It provides a quick and easy way of recording actions and creating test automation script of the supported applications. There are three recording modes as Normal Recording, Salesforce Recording and Workday Recording.
Getting started with Chrome Addon
Select or create an Object Repository > select Chrome AddOn and Chrome Browser and then click on Get Extension (if Chrome Addon is not added to your Chrome browser).
Integrating Chrome Addon (OpKey Recorder) to Chrome:
You are redirected to integrate the Chrome Addon extension in your Chrome Browser.
- Click on Add to Chrome to add it to Chrome.
- Chrome Addon (Opkey Recorder) has now integrated with your Chrome browser and now you can use it.
- Click on the extension icon to launch Chrome Addon.
- Opkey on Chrome window opens up.
- Enter your Opkey domain name with valid credentials and click on Login.
- After successful login, you come to the page where you’ll have to select the Create Opkey Test icon.
- On the next window, you need to select the Record Test button, select artifact, enter the artifact name, and application URL and then click on Start Recording button.
- Select your Project from the dropdown list.
- Select the type of artifact (Test Case or Function Library) you want to create.
- Enter artifact name & application URL on which you want to start the recording session.
- If you want to work on an existing Test Case or Function Library then check Record on existing Test Case/Function Library radio button to proceed. You will be redirected to the Artifact page from where you can select your desired artifact and start working.
- Your Test Case or Function Library and Object Repository will be created under Default_Opkey_Location folder in Project Workspace.
- Click on Start Recording to begin your recording session.
- Type URL of your web application and press enter. Alternatively, you can enter the application URL directly in the Chrome browser and proceed recording session.
- Here you can view that the actions performed on the application are recorded by the Chrome Addon along with their object, object properties & respective Opkey keywords.
- Spy mode of recording allows you to view object properties without fetching it. To do so, press the Ctrl button and hover the mouse on the object. Here, you can view object properties. You can use the Capture image to create a new object feature to capture the desired image, create an object and set respective Visual keyword for action. Click on Capture image to create a new object button, Opkey Smart Image Snipper page opens. There are few buttons like crop, rotate image left & right, undo, redo, abort and add image to Opkey. You can use these buttons.
Note: For details about working with Spy mode of recording using Chrome Addon, please refer: Using Spy Mode of Opkey Recorder
- Once the recording session has completed, switch to the Record mode and click on Stop & Save button.
- When you click on the Stop & Save button, there is a popup message that Are You Sure you want to stop recording? Click Yes.
- Your Test script has been created successfully. Here, you can view the Test Case.
- Further, you are redirected to the corresponding Opkey Web Domain to look at the newly created Test Case or Function Library. From here, you can execute it and analyze the execution result.
Your test case script is created successfully by recording with Opkey Smart Recorder. And, you also have a separate object repository to store your data. It’s looking good; isn’t it?
Now, you can improve this test even further. Replace the static value and configure your test to pick dynamic data from Global data repository file. In other words, you can parameterize your test script and it is pretty easy in Opkey. Let’s see how you can do this.
But, before parameterizing, you need to create a Global Data Repository file from which the data will be picked by following below steps:
- Create a New Global data repository file. Right click on a root folder > Create New Global Data Repository. Enter values within the cells as per your required test scenario.
- Open your test case and go to the Data Input Argument in the right pane. Select your Global DR file and expand it.
- Go to the specific test case step and map with the corresponding column to pick its data value. The static value of your recorded test case step will be replaced with the mapped Global DR value.
- During the execution of that test case, the first iteration will be executed with the first cell value of the mapped column and so on.
Now, click on the Run now button to execute your Test script. You need to select Session Name, Choose or Create Build, Plugin used, Execution Agent and Generic Plugin in Execution Wizard to proceed execution process.
Show Advanced Settings option is available in execution wizard which helps you configure Snapshot of steps (along with quality and step timeout), session tags and global variables.
Before starting execution on your local machine, make sure that Opkey Execution Agent is configured & running properly on your machine. In case of execution on cloud, there is no need of Opkey Execution Agent.
Just after a few seconds, a dialog box appears with the notification message Execution Started Successfully.
Once, execution gets started, Execution Logs are generated. You can go through execution logs and analyze your test execution.
The execution has passed successfully. You can select the specific test steps and view the input and out data. You can export execution reports in different formats: Summary, Detailed, IntegratedDataReport, and Gherkin Report.
You can also Expand all and Collapse all executed steps by using respective buttons whether they are fail or pass individually. You can delete the selected execution result. The search feature is also included in the execution result.