Using Collection Keywords - Opkey Classic

Keywords offer a set of predefined commands for creating test cases for any application or software. With keywords, you can easily write test steps with input and output data without the need for complex coding. 


How to use Keywords?

Keywords are used by calling them in a test step and adding the input and expected output data values. If you want to capture the dynamic objects, you can also add properties of the object in the test object column. 

Let's understand this with an example of using the AddItemInCollection keyword.

This keyword adds an item to the collection. It takes Collection Data & items to be added as input data arguments.

1. Add a new step in your test case by clicking the + icon at the top. Search AddItemInCollection and click on the search result to add it to the new test step.


2. Click the Three dots icon in the input data column of the step to open the input data window for the keyword. 


3. Add the input data in relevant sections as shown below and click the OK button at the bottom.



These values are filled in their respective columns as per the requirement in the test case as shown in the image below. We have given similar tables for each keyword for illustration. 

In the AddItemInCollection Keyword, there was no requirement to add a Test Object's properties, hence, we have mentioned it is not required.


Input Data


 Input Data Required

 Description 

 

Collection Data

 Add the Collection Data from Global Variables or use the local static data.  

name of item

 This takes the name of items to be added to collection data as data input. 



Output Data

Condition
Output value

If the keyword passes successfully

Item added to Collection Data 

if there is an error


Value not added






Example


If you want to add Item: dff in Collection (Data) 

Data : [
"asd",
"asdf",
"add"

then you can use the AddItemInCollection keyword. The output will be

[
"asd",
"asdf",
"add",
"dff"
]

Common Error conditions

This keyword fails in the following common error scenarios as given below - 

  

Condition

Debug Information

Message

If No data is provided

One or more of the arguments have not been provided with a value

Argument Data Missing (-13200) 

DESCRIPTION: 

A step might fail if it lacks values for required arguments. While certain arguments are optional, mandatory ones must be supplied with data. This data can be entered statically, derived from a prior step's output, sourced from a global variable, etc. It should not be left blank to ensure proper execution. 

If the Item to be added is not given

One or more of the arguments have not been provided with a value

Argument Data Missing (-13200) 

DESCRIPTION: 

A step might fail if it lacks values for required arguments. While certain arguments are optional, mandatory ones must be supplied with data. This data can be entered statically, derived from a prior step's output, sourced from a global variable, etc. It should not be left blank to ensure proper execution. 


Please go through the list of Collection keywords by clicking the link below.

List of Keywords - Collection Keywords

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 atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article