Keywords Used in algoQA

Modified on Wed, 18 Sep at 2:04 PM

TABLE OF CONTENTS

1. Overview

1.1 General Keywords

1.2 Database Keywords

1. Overview

This article describes about various keywords used, and their functionalities in algoQA. Keywords are used to define the parameters or conditions and actions within a test step.

1.1 General Keywords

The following table describes keywords used in algoQA and the description: 

Keyword Description 
||Applicable to iFrame.
Checks for either an anchor (<a>) element containing "<name>" or an iframe with the specified ID. If either of the condition is true, it implies that the target element can be selected, allowing interactions with both links and iframes on the page.

For example, to interact with an embedded YouTube video on algoshack.com page, use the XPath //a[contains(.,'AlgoShack')] || //iframe[@id='youtube-video'] to navigate, play, pause, and verify the video details, then return to the main content and close the browser session.

--

Applicable to these actions: verify pdf data, verify file format, verify json file value, verify column name present in the spreadsheet and verify data present in the spreadsheet.

When entering data into specific cells within a Microsoft Excel spreadsheet using the file path format, you use the following structure:
-- path of the file,sheetname,celldata-rownumber-colnumber,celldata2-rownumber2-colnumber2

In this format, the "path of the file" represents the full path to the Excel file on your system where you intend to perform data entry operations.


For example, you have an excel file named 'SalesData.xlsx' located at C:\Users\YourUsername\Documents\. Within this file, there is a worksheet named 'QuarterlyReport' where you want to enter the following data:

  • "Total Sales" into cell B3 (2nd row, 3rd column).
  • "Average Revenue" into cell D5 (4th row, 5th column).

You can use the format (filePath, sheetName, celldata-rownumber-colnumber, celldata2-rownumber2-colnumber2) to specify these operations. For the preceding example, here is the path:

-- C:\Users\YourUsername\Documents\SalesData.xlsx,QuarterlyReport,"Total Sales"-2-3,"Average Revenue"-4-5.


-Applicable to 'verify one of the value' action. Verifies any of the parameter values present on the page.
For example, 

On the MakeMyTrip.com, you would perform the action as follows:

verify one of the value from this list: Flights-Hotels-Homestays & Villas. 


Expected Outcome: The action checks if at least one of the following is displayed on the page:

  • Flights
  • Hotels
  • Homestays
  • Villas

If any of these options are visible, the verification is successful.

@@Used as a custom-specific or project-specific tags which can be seen in Feature Files. For example, @@SmokeTest.

**Applicable while using 'Remove all items' from the cart and 'scroll and verify tooltip' actions.
Separates each XPaths with double asterixis (**).
For example, in case of remove all items from the cart using XPaths if you have two or more XPaths, then you can use ** to separate these XPaths.
Format is (//input[@aria-label='Remove'])[3]**(//input[@aria-label='Remove'])[2]**//input[@aria-label='Remove'])[1]

This keyword is applicable to both mobile and web automation
_and_If you don't want the default last step (where the current screen is displayed with "NA") to appear in the Feature File, and instead wish to generate custom messages, you can use _and_ to combine conditions.

To access no postcondition option, navigate to Edit Scenarios > Edit Scenario Form > select 'no postcondition' from TestStep Settings dropdown option and provide custom messages in the Messages text box.
Example: Checking if a button is both enabled and visible before clicking it.

if (loginButton.isEnabled()_and_ loginButton.isDisplayed()) {

    loginButton.click();

}

Button Visibility and Enablement custom messages.


"Login button is visible and enabled. Proceeding with the click."

"Login button is not enabled, action cannot be performed."


DOUBLE_QUOTE<value>DOUBLE_QUOTEWhile editing a scenario, if you enter a custom value into Custom Value text box in the format suggested in the left column, then you will see the value generated in the Example table of Feature File.
Note that you can add custom value into Custom Value text box while recording a scenario using Follow Me feature.
For example, consider a scenario where currency is to be verified for various countries.
GWT steps with the example table is as follows: 
While editing a scenario in the Edit Scenario Form, if you wish to pass a parameter within a test step, then enter the value in the format suggested in the left pane by selecting inline drop-down option in the 'TestStep' Settings drop down list, then you will see the value in the corresponding GWT step in the Feature File.
Consider the same example, GWT step is highlighted in the screenshot:
If wish to generate these custom values with double quotes in a separate YML file, then enable Data Decoupling option in the Project Settings page.
For the same example, test data is generated in a separate YML file, as follows:

If you wish to remove the added double quotes, then enter the value in the following format:
 "<value>" .
<Value>COLON_COLON<Value>During the Node configuration, while configuring UI element, you can pass the parameter in the following format  <value>COLON_COLON<value> in the Control Value text box.
For example, 
In a given application, this parameter is used to filter and refine search results. If you wish to filter age between 18 and 35 while verifying patient details on an application, then you can add the parameter in this format - 18 COLON_COLON 35. You will see the age in the example table of the generated Feature File, as shown:
If wish to generate this parameter in a separate YML file, then enable Data Decoupling option in the Project Settings page.
For the same example, test data is generated in a separate YML file, as follows:
While generating test cases in API Test Automation, then you must pass the parameter in the 'Params' tab of the specific Request name in the following format: 
User::Email ID
You can generate the test data in a separate YAML file using the preceding format.
Feature File will be generated, as shown:


@randomemail

During Node configuration, when setting up UI elements, you can pass parameters in the following format: @randomemail. This format will generate a random email address with the default format @<randomname>@gmail.com in the report generated.

However, parameters can be customized to suit specific needs. For example, if you prefer to use a different email domain, you can specify the parameter as @randomemail@Yahoo.com. This will generate a random email address with the domain @yahoo.com, such as user123@yahoo.com.

For example, if you want to generate a random email address for user registration, you can use @randomemail. The system will create an email like user123@gmail.com where user123 is a randomly generated name. Verify the registration process by checking that the registration is successful and that the confirmation message includes the generated email address.

 
@randomtext

During Node configuration, when configuring UI elements, you can use the @randomtext parameter to generate random text. This parameter creates a string of random characters, which can be useful for fields requiring unique values, such as usernames or addresses.


For example, if you want to generate a random username for a new user registration, you can use the @randomtext parameter. This will produce a value like userXyZ123 where userXyZ123 is a randomly generated string. You can then use this randomly generated username to fill in the registration form and verify the registration process. Ensure that the registration is successful and that the confirmation message includes the randomly generated username.


@randomnumber

During Node configuration, when configuring the UI elements, you can use the @randomnumber parameter to generate a random numeric value. This parameter produces a number within a specified or default range, which can be useful for fields that require unique values, such as order numbers or IDs. For example, if you want to generate a random order number for a transaction, applying the @randomnumber parameter will produce a value like 4832, where 4832 is a randomly generated number within the default range (e.g., 0 to 9999) or a specified range if provided. You would then use this randomly generated number in the transaction form. Ensure that the transaction is processed successfully and that the confirmation message includes the randomly generated order number.


@copiednumber


During Node configuration, when configuring UI elements, you can use the @copiednumber parameter to insert a previously copied numeric value into your fields. This parameter allows you to reuse a number that has been copied from an earlier step or from another part of the test. For example, if you copy an order number 7564 from one part of your test and use the @copiednumber parameter, it will insert 7564 into the current field. This is particularly useful for scenarios where you need to maintain consistency by reusing the same number across multiple steps or actions. Ensure that the copied number is correctly applied in the relevant fields and that any subsequent actions or verifications are consistent with this reused value.


@currentDirectory

During Node configuration, when configuring UI elements, you can use the @currentDirectory parameter to refer to the path of the current working directory within your test environment. This parameter dynamically inserts the path of the directory from which the test scripts are being executed. For example, if your test scripts are executed from the directory

C:\Users\Admin\Downloads\ScriptGeneration\AlgoAFScript

, using the @currentDirectory parameter will automatically insert C:\Users\Admin\Downloads\ScriptGeneration\AlgoAFScript into the relevant field. This is useful for scenarios where you need to specify file paths or directories relative to the test's execution of scripts. Ensure that the path inserted by @currentDirectory reflects the intended directory and is used in subsequent verifications.

@convertDate_10 Jan 2020_dd MMM yyyy_dd/MM/yyyy

During Node configuration, when configuring UI elements, you can use this 

parameter, which allows for flexible date formatting, enabling you to convert dates to your desired format.

Input Date: Specify the date you want to convert (for example, 10 Sep 2024).

Input Format: Define the format in which the input date is provided (for example, dd MMM yyyy).

Output Format: Indicates the output format as dd/MM/yyyy.

Example Combinations

You can use various combinations to achieve different results. Following are a few examples:

Example 1:

  • Input: 15 Mar 2024
  • Input Format: dd MMM yyyy
  • Output Format: dd-MM-yyyy
  • Result: 15-03-2024

Example 2:

  • Input: 01/04/2024
  • Input Format: dd/MM/yyyy
  • Output Format: yyyy-MM-dd
  • Result: 2024-04-01


1.2 Database Keywords 

      The following table describes database keywords used in algoQA and the description: 

Keyword Description 
Custom-specific parameter for PostgreSqlRetrieve data from Postgresql  database and verify it using parameterized query.
For example, consider a scenario where you have a table called employees, and you want to fetch all records where the department is "Sales." Your query would look like this:

you can pass the parameter in the following format during the Node Configuration: PostgreSql_#Query1:-SELECT * FROM employees WHERE department = 'Sales';.
For more information, refer to Adding a Parameter in the Node Configuration.
get data from db and verify

Retrieve data from a database and verify it using a parameterized query
For example, consider a scenario for verifying the user details from database and check that user information is correctly stored in the database.

  • Accessing the Database: Ensure we have a secure connection to our database system.
  • Executing the Query: Search for specific user details using their username.
  • Verification: Confirm that the user's details, such as their username, email address, and role, match what we expect.

you can pass the parameter in the following format during the Node Configuration: <database>_#Query1:-<add your query>. In this, replace <add your query> with your actual query statement.

get data from db and verify in mongodbRetrieve data from Mongo database and verify it using a parameterized query
Use the same preceding example except that you would be verifying user details from mongo database and check the user information stored in mongo database.

you can pass the parameter in the following format during the Node Configuration: Mongodb_#Query1:-<add your query>. In this, replace <add your query> with your actual query statement.

verify db data in sqlVerifies the data in a database involves running SQL queries to check for the existence of certain data.
For example, check if there are any users whose status is 'active' using the following SQL query:
SELECT *FROM users WHERE status = 'active';
use this query to verify the presence of active users in the users table. If the query returns any rows, it confirms that there are active users. This type of verification is useful in scenarios where you need to ensure certain conditions are met or to gather specific information from your database.

You can pass the parameter in the following format during the Node Configuration: Sql_#Query1:-<add your query>. In this, replace <add your query> with your actual query statement.
update db data in sqlUpdating data in a SQL database involves modifying existing records based on certain conditions or criteria.

For example: Updating Product Price in SQL Database

Consider a table named products with columns product_ID, product_name, category, and price. Let's update the price for a product with product_ID = 123.

you can pass the parameter in the following format during the Node Configuration: Sql_#Query1:-<add your query>. In this, replace <add your query> with your actual query statement.
get date from db and verify datetime (staging)

Retrieve and verify datetime values from a database, you can execute a query that fetches the relevant records and checks if the retrieved dates meet certain criteria. 


For example, consider a scenario for retrieving user registration dates from a database and verify if they are within the last 30 days.


Assume that you have a table called users with a column registration_date, your query might look like this:

SELECT * FROM users

WHERE registration_date >= NOW() - INTERVAL '30 days';


You can pass the parameter in the following format during the Node Configuration:

Sql_#Query1:-SELECT * FROM users WHERE registration_date >= NOW() - INTERVAL '30 days';

verify db data in mysql

Verifies database data in MySQL, execute queries to check for specific conditions. 


For example, consider a scenario to verify if there are any users whose status is "active."


To check for active users in a table called users, your query might look like this:
SELECT * FROM users

WHERE status = 'active';


You can pass the parameter in the following format during the Node Configuration:

MySQL_#Query1:-SELECT * FROM users WHERE status = 'active';

copied db data in sql

Involves copying specific data from one table to another within a SQL database. The query selects particular columns from a source table and inserts them into a target table, which is useful for reporting or data migration purposes.


For example, consider a Table1 containing customer information, and you want to copy specific columns into Table2.

To copy customer_name, email, and phone_number, you can execute:


INSERT INTO Table2 (customer_name, email, phone_number)

SELECT customer_name, email, phone_number

FROM Table1;


You can pass the parameter in the following format during the Node Configuration:

Sql_#Query1:-INSERT INTO Table2 (customer_name, email, phone_number) SELECT customer_name, email, phone_number FROM Table1.





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