Creating and Executing an Automated Test Case




In Opkey, you can efficiently create and manage both automated test cases in the Automate section. This section is specifically designed to cater to the needs of Testers and QAs, providing a centralized hub to oversee all test cases and their associated test data.


For example, let's say you need to test a validating user login scenario in an ERP system. With Opkey's recorder, you can quickly create an automated test case by capturing actions such as entering credentials. You can also use keywords to add steps to sign out from the application. 


In this article, we will create and execute a test case for testing signing-in and signing-out functionality on a demo web application.


1. Hover over the Automate section and click Test


2. Click the Create Test button to select Automated Test Case.




3. The "Create Test Case" window opens on the right. Fill in information such as Name, Priority, and Description, and choose an Assignee.  You can also add attachments like spreadsheets, videos, images, etc., to this test case. Once done, click the Create button at the bottom.



4. Now, to add steps in the empty test case, click on the "Recorder" option.



5. Select "Web" recorder as we are testing a web application, and click "Start Recording" to begin the recording process. 



6. The Opkey recorder window and a default web page open up. Enter the URL and use the login credentials to sign in to the web page.



7. In the recorder window, you can see the corresponding steps getting recorded with their object details. We can scroll down on the window to look at all the object properties of the selected step. 

For example, in the image below, we can see the related "Username" object with its screenshot captured from the test application.  


8. When the objects are recorded by Opkey recorder, the recorded objects gets named based on the properties of the objects. These names can be sometimes be vague as their properties. To avoid such scenarios we can change the name of the object during recording itself. The name of the object can be edited in the field shown in the image below.


Note: Once you Save and Close the recorder window, the steps are saved in the test cases and an object repository is created by the name of test case. You can use objects saved in the repository in other test cases.

9. Once done, click on the "Stop and Save" button and click Yes on the pop-up that follows.



10. Now, you can see the test steps are added in the test case. Save these steps.



11. Now to enhance this test case further by adding test step with a keyword, select the last step and click on the Add Step button at the top to add a new step after it. Search the ClickButton keyword and click on its search result.



12. Click Dynamic Object for the ClickButton step. The dynamic object possesses changing object properties. In this example, we aim to locate the Sign Out button on the webpage. Add Sign Out as the value for the logical name and TextToSearch parameters in the dynamic object property.

This will enable Opkey to locate the Sign Out button using these object properties and proceed with the step. Finally, click the back icon at the top and close the input data window.


Now, let's go through some of the features of the test case page.

From the right panel, you can change the mode of the test case. The two available modes are Manual and Automated.



Once you change the test case mode to manual, the automated test case get's converted to an empty manual test case. Here, you can add steps manually by adding their input data and specifying output. Switching the mode back to automated will change the test case back to original one.



The Datasheet mode allows you to add the datasheet to the test case having stored data in a spreadsheet format. You can either add the Local Datasheet or the Global Datasheet.



The State tab allows you to change the states of the test case. The available states are Draft, Review, Approve, and Publish.



The Milestone option allows you to link the test case to a milestone for tracking. For example, you can add Testing Post Patch as your milestone.



The Assignee option allows you to add an assignee for the test case. For example, to assign this task to a team member, select their name from the dropdown menu and add them. 



The Reporter option allows you to assign the reporter for the test cases. For example, to add a Reporter to this test case, select the name option from the dropdown menu and add them. 




The Reviewer option allows you to select and add a reviewer to this test case. The reviewer can change the state of the test case after analyzing its test execution.



The Priority section allows you to set the priority of the test case. The available options are 

Blocker, Highest, High, Medium, Low




Set the due date of the test case using the Due Date option. This option is useful for project admins who want to set a deadline for work completion on the test case.



The Tags option allows you to add Tags with a Key and Value. You can effortlessly search for test cases with the set tag. You can set a tag based keys such as Application, Application_Process, or Priority.



Next, add a value to your test case from the available options in the dropdown. Tick the checkbox for Save for Execution and Click Add. 



Set the estimated time for completing the task related to the test case with the Original Estimate field.




The Time Tracking tab helps identify the time spent on a task and the time remaining based on the original estimate.



For example, if the original estimated time for task completion is 3 hours. Click the Time Tracking tab to see how much time has been spent and how much time is remaining.


 

You can create forms for your test cases using the Form Builder option as per your requirement. These custom forms are available in the right panel as shown.



These forms are useful for tracking test cases based on selected tags. You can customize your forms and add the required fields. For example, in the image below, the Salesforce application has a dropdown with options for unit, regression, and option 3. When the unit option is selected, the test case is saved accordingly, making it easier to locate. 


 

You can save the respective test cases in a specific location and easily view them whenever needed. This saves time and effort. This feature is also helpful in reporting, as reports can be reviewed based on the selected tags. 


To parametrize, you need to add reusable components in the test case, wherein input-output parameters can be added, read this article: Creating Input-Output Parameters


Now, let's execute this test case.

1. Save the test case and click the Run icon. Select Run on Browser.



2. Provide a run name and select the desired browser.


3. Run Wizard Opens up. Add a name for the test run and select the milestone to link it. Here, you can also select the browser to run the test case. 

Note: If you've specified a browser name in your test case, the execution will use that browser. This happens even if you choose a different browser in the Run Wizard window. 

For example, if you have specified Microsoft Edge browser in the first step of test case, but you have selected Chrome browser in the Run Wizard window, then the test case will execute in the Edge browser as specified in the test case.



4. Click on Advanced Settings to add a build name, select the agent, and click Start Run to begin the execution.


Note: If you are a Mac device user, select Agent Spock to execute the test. Use Opkey Execution Agent to execute test cases on a Windows device.



5. In the Advanced Setting tab, you get the option to choose from the two available options:


Use Suggested plugin - This lets you add the test case-specific plugin.


Last used plugin - This lets you select the last used plugin for execution. 


 


6. Under the More Settings tab, you get the options of :


Update mapped data steps: This helps update the mapped data in the current steps.


Skip empty data steps: This helps skip the empty datasets in a test case.


Randomize input default valueIt allows data to be picked randomly from either the local datasheet or the global datasheet.


Highlight Object: This helps to highlight the objects during execution


Perform Visibility check: It first checks whether the object is present in the application.


Enable Step Logs: This helps generate step logs after execution.




7. If you want to view the executions on the remote machine, click on the View Live Run button. 

This feature is particularly useful for executing test cases across multiple virtual machines, eliminating the need to manually log in each time you want to view the results or their status.


Note: To continue working with the Live run feature, please take a look at the pre-requisite document.




8. Once the execution is completed, click "View Result" to analyze the test case results.



9. Here we can see our result.




You've reached the end of this article and are now well-prepared to create and execute automated test cases. 

Ready to dive deeper? Check out the next article: Creating Reusable Components.

Explore, experiment, and achieve your testing goals on Opkey!



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article