List of Keywords - System Keywords 2

To learn how to use System keywords in Opkey, you can read Using System Keywords - New UI and Using System Keywords 1 - Opkey Classic.
 

Now, let's go through the second list of various system keywords to understand their utility.

 

1. FetchRecordSetFromDatabase 

 

The primary purpose of the FetchRecordSetFromDatabase keyword is to fetch a record set from a database. This keyword is used to fetch a #:#:#:# separated recordset database. 

 

Let's understand the keyword by an example:-

Suppose there is a "users" table with columns such as "id," "name," "email," and "department," and you want to fetch all records where the department is 'IT'. 


Now to fetch the record set from the database you will need to execute the following query in your test case:-


FetchRecordSetFromDatabase Query : SELECT * FROM users WHERE department = 'IT' ;

Here ,the FetchRecordSetFromDatabase is the Opkey keyword that is used to retrieve a record set.

The Query parameter specifies the SQL query to be executed. You will enter this query in the input data field.

As a result, it will fetch all the columns (*) from the "users" table where the department is 'IT'.

The result of the query will be a set of records matching the criteria.

 

In the FetchRecordSetFromDatabase Keyword, there was no requirement to add a Test Object argument. Hence, we have mentioned it is not required.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 

CommandTimeOut

Specify the command timeout


Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions


Conditions

Error Message 

Debug Information 

When Invalid data arguments are provided. 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

CresTech.OpKey. 

Exceptions. 

MalformedQuery 

Exception: Unable to execute the query. Possibly syntax error or insufficient parameters. 

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

  

 

2. FetchAllRecordsFromDatabase 

 

The FetchAllRecordsFromDatabase query is used in Opkey to retrieve all records from a specified database table. This keyword is used to fetch a  @:@:@:@ separated recordset database


Let's understand the keyword with an example.

 Assume that you have an "employees" table with various columns like "employee_id," "first_name," "last_name," "email," and so on.

Now you want to fetch all the records of the employee table from the database.

You will use the following query:-

FetchAllRecordsFromDatabase Query: Select*from employees;

Here the FetchAllRecordsFromDatabase keyword is used to fetch all records from the "employees" table.

The Query parameter specifies a simple SQL query to select all columns (*) from the "employees" table. You will enter this query in the input data field.

The result of this query will be, all the records from the "employees" table.



In the FetchAllRecordsFromDatabase Keyword, there was no requirement to add a Test Object argument. Hence, we have mentioned it is not required.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 

CommandTimeOut

Specify the command timeout


Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

 

Conditions

 

Error Message 

Debug Information 

When Invalid data arguments are provided. 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

 

CresTech.OpKey. 

Exceptions. 

MalformedQuery 

Exception: Unable to execute the query. Possibly syntax error or insufficient parameters. 

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

 

3. FetchValueFromDatabase 

 

This keyword fetches a single value from the database


Let's assume you have a table named users in your database with columns username and email.

If you want to fetch the email address of a user based on their username, you can do so by using the FetchValueFromDataBase keyword.


In this scenario, the FetchValueFromDatabase keyword can be used to execute a SELECT query - ."SELECT email FROM users WHERE username = ?;"   taking username as a parameter to fetch the corresponding email address, and returns the result.


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Object input Argument Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 



Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

 

Conditions

Error Message 

Debug Information 

When Invalid data arguments are provided. 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments was not what was expected. This might happen when the input is expected in a specific format or should be chosen from a predefined set of values. Check for spelling errors and capsing. 

CresTech.OpKey Exceptions: MalformedQuery. Unable to execute query due to syntax error or insufficient parameters.

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

 

4. FetchValueFromProcedure 

This keyword fetches a single value from a procedure. 


Let's assume you have a stored procedure named get_email_by_username that takes a username as a parameter and returns the corresponding email address.


Now to fetch the email address of a user from this procedure, you have to provide input data in the following manner.

  


Procedure Name 

get_email_by_username 

Param Name  

username

Param Value 

Sakshi


The result will be the corresponding email address.


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Object input Argument Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Procedure Name 

Specify the Procedure Name. 

Param Name
Specify the Name of the parameter 
Param Value 

Specify the Value of the parameter 



Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

   

 

Conditions

Error Message 

Debug Information 

If no Data Input Argument is provided  

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

One or more of the arguments have been provided a value. 

When Invalid Data Input Arguments are provided 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

Data Not Provided 

 

5. GetColumnCountOfRecordSet 

 

This keyword fetches the number of columns of a record set


Assume that you have an "employee" table and you want to know the column count of that table. You can use the keyword with input query - get_column_count_of_record_set(employee) to retrieve information about the number of columns in the employee table. 

e): 

In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Object input Argument Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 



Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

 

Conditions

Error Message 

Debug Information 

When Invalid data arguments are provided. 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

CresTech.OpKey. 

Exceptions. 

MalformedQuery 

Exception: Unable to execute 

the query. Possibly 

syntax error or insufficient parameters. 

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

 

6. GetRowCountOfRecordSet 

 

This keyword fetches the number of rows of a record set


Assume that you have an "employee" table and you want to know the row count of that table. You can use the keyword with input query - get_row_count_of_record_set(employee) to retrieve information about the number of rows in the employee table. 

 

In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Object input Argument Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 

 

Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

 

 

Conditions

Error Message 

Debug Information 

When Invalid data arguments are provided. 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

CresTech.OpKey. 

Exceptions. 

MalformedQuery 

Exception: Unable to execute the query. Possibly syntax error or insufficient parameters. 

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

 

7. UpdateDatabase 

 

This keyword executes the update database query which is run to modify the existing records in a table. It allows you to change the values of one or more columns in one or more rows based on a specified condition. 


Let's say you have a table named users with columns user_idusername, and email. You want to update the email address for a user with a specific username: 


You can use the query - UPDATE users SET email = 'joe@gmail.com' WHERE username = 'joe'; 

This query will update the email column in the users table, setting it to 'joe@gmail.com' only for the row where the username is 'joe'. 


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Test object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data


Input Data Required

Description

Query

Specify the Database Query 

 


Output Data

Condition


Output value

If the keyword passes successfully

The query will be executed and will display the desired output

If there is an error

False


 

  

Error conditions

 

Scenarios 

Error Message 

Debug Information 

When Invalid data arguments are provided 

Argument Data Invalid (-13300)  

DESCRIPTION:  

The data value for one or more input arguments does not match the expected format or predefined set of values. Please review for spelling errors and capitalization. 

CresTech.OpKey Exceptions: MalformedQuery. Unable to execute query due to syntax error or insufficient parameters.

When no data input arguments are provided 

Argument Data Missing (-13200)  

DESCRIPTION:  

A step can't proceed without values for mandatory arguments. Unlike optional ones, compulsory arguments must be filled with data, which can come from a static entry, a previous step's output, or a global variable. Leaving them empty is not allowed. 

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

  

8. Date Time Keywords

 

(I). ConvertTimeToTimeZone 


This keyword converts the time from source to destination time zone concerning the time of our local system.  


It is employed when there's a need to convert time from a source time zone to a destination time zone, especially when the working system is configured in a different time zone. 


For Example: If you want to change the time from “India Standard Time”, to “US Eastern Standard Time”, you can use this keyword. 


You can provide the following data input arguments. 


Select the "source time", provide “SourceTimeZone” as “India Time Zone” and provide “DestinationTimeZone” as “US Eastern Standard Time”. 

 


SourceTime 

2/7/2017 12:00:00 AM 

SourceTimeZone 

India Time Zone 

DestinationTimeZone 

US Eastern Standard Time 

It will provide time according to the destination time zone in output. 


Note: Source time will be the time of your system, and to get names of time zones you can go to this link” https://technet.microsoft.com/en-us/library/cc749073(v=ws.10).aspx. 


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.


Input Data



Input Data Required

Description

SourceTime 

Specify the requirements which you want to use for conversion. 

Note: This time will be available to you as per your local system. 

SourceTimeZone 

Specify your Source Time Zone. 

Note: Note: All timezone are specified at “https://technet.microsoft.com 

/en-us/library/cc749073(v=ws.10).aspx”. 


DestinationTimeZone 

Specify your Destination Time Zone, in which you want your output. 

Note: All timezone are specified at “https://technet.microsoft.com 

/en-us/library/cc749073(v=ws.10).aspx”. 


 


Output Data


 Condition  Output Value

If the provided time zone is of the correct format. 

Time according to destination time zone 

If provided data input arguments are blank or have an invalid format. 

False

Error Conditions


Condition 

Message 

Debug Info 

If the specified time zone is blank. 

Argument Data Missing 

Timezone argument is missing. 

If the specified time zone is invalid. 

Argument Data Invalid 

The time zone ID 'US' was not found on the local computer 

 

(II). GetTimeAtTimeZone 

 

This keyword offers the time of a specified time zone in relation to the local system time. It proves useful when obtaining the time of different time zones while your working system is configured in a different time zone. 


For Example: your working system is configured in “India Standard Time”, but you want to see time in “US Eastern Standard Time”. 


In the given example, if you wish to retrieve the time for the US, input "US Eastern Standard Time" in the "timezone" data input argument of the "GetTimeAtTimeZone" keyword. This will provide the time for the specified time zone. 


TimeZone 

Provide the correct time zone 


Note: Source time will be the time of your system, and for getting names of time zones you can go to this link” https://technet.microsoft.com/en-us/library/cc749073(v=ws.10).aspx . 


In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object



Object Input Arguments Required?

Description

No

This keyword doesn’t take any object input argument.



Input Data



Input Data Required

Description

Timezone 

Specify the time zone in which you want to get your output. 

Note: All timezone are specified at “https://technet.microsoft.com/ 

en-us/library/cc749073(v=ws.10).aspx”. 

 


Output Data


 
  Condition


  Output Value


If the provided time zone is of the correct format. 

Time of specified timezone 

If the timezone provided is blank or has an invalid format. 

False



Error Conditions


Condition 

Message 

Debug Info 

If the specified timezone is blank. 

Argument Data Missing 

Timezone argument is missing. 

If the specified timezone is invalid. 

Argument Data Invalid 

The time zone ID 'US' was not found on the local computer 

  


(III). AddDateTime 


This keyword adds a specific number of days, months, years, hours, minutes, and seconds to each date value. 


Suppose you want to add a specific number of days, months, years, hours, minutes, and seconds to your date (12/20/2023)


Here you can provide the input data in the following manner to get the desired output.

  

Keyword Name 

Input 

Output 

Status 

   AddDateTime

DateTime : 2/15/2017 12:00:00 AM 

Years : 2 

Months : 2 

Days : 2 

Hours : 2 

Minutes : 2 

Seconds : 2 


4/17/2019 2:02:02 AM


 Pass

 

In this Keyword, adding a Test Object argument was not required. Hence, we have mentioned it is not required.


Test Object


Test Object Required?

Description

No

This keyword doesn’t take any object input argument.




Input Data



Input Data Required

Description

Date Time 

Years 

Months 

Days 

Hours 

Minutes