26.17 Collection and KeyValuePair
There is are two new variable type added in OpKey – Collection & KeyValuePair. Collection Variable allows you to add multiple values of String, Integer, Double, DateTime & KeyValuePair type and use them accordingly. You can add your own private collection variable and use them across your tests.
It is available with Local Data Repository (LDR), MBT (input parameter & output parameter, Custom Keywords, Function Library (Input parameter & output parameter) etc. You can also sync & make replica of artifacts collection variables & modify global Collection variables at runtime. You can use the Collection & KeyValuePair type of variable by using specific keywords which are created for these keywords. There are few additional new keywords added in this release corresponding to the Collection & KeyValuePair variable type.
Need of Collection & KeyValuePairCollection:
While working on OpKey, user sometimes need to provide collection of strings, Integers etc. as input arguments which was not possible earlier. Now, you can provide collection of string, Integer, Double, DateTime etc. as data input argument, input parameter in FLs, as per your requirement.
Creating Collection & KeyValuePair Collection in Global Variables:
User can easily create Global Variables of Collection and KeyValuePair Collection type and use them across test scripts, as per requirement.
Click on Global Variables under Tools menu on OpKey Web Dashboard. Global Variables window opens.
Click on Add button to add a new Global Variable. Enter Name, select Data Type as Collection & you can see here that you can create String, Integer, Double, DateTime & KeyValuePair type of Collection.
Select a type of the Collection Data Type and enter values. There will be an Add Collection (+) in Value column, corresponding to the newly added Global Variable.
Click on Add Collection. Add New Private Collection window opens.
Click on Add Item button and add Collection values. Click on OK.
Your Collection of String data type has been created successfully. You can create other data type Collections from here.
Another new Collection type is KeyValuePair. Add new Global Variable, enter name & select KeyValuePair as data type from the dropdown.
Click on Value field corresponding to the KeyValuePair & add values.
Here, you can view that newly created Collection & KeyValuePair type of Global Variables added successfully. Now, you can use them as a Global Variables with Collection & KeyValuePair keywords.