Skip to main content

Grouping - Automation Commands

Description

The grouping functions allow you to group steps together, making the generated test reports easier to read and manage. This helps reduce the overall number of steps displayed, improving performance when viewing reports with many steps.

The grouping functions include:

  • startStepsGroup - Starts a group of steps
  • setGroupStatus - Sets the status of the group to either Passed or Failed
  • stopStepsGroup - Ends the grouping of steps
info

This automation command is supported for both Appium (Mobile Devices) & Selenium (Desktop Browsers).

Parameters

startStepsGroup

Parameter NameValueDescription
groupNameStringSpecifies the name for the group that will appear visually in the generated report, helping to identify and categorize the grouped steps

setGroupStatus

Parameter NameValueDescription
statusStringA status for the group. Accepted values are Passed or Failed

stopStepsGroup

No parameters required. Ends the grouping that was started with StartStepsGroup.

Code Example

The grouping commands can be executed using the executeScript function:

Java-

  1. driver.executeScript("seetest:client.startStepsGroup", groupName);
  2. driver.executeScript("seetest:client.setGroupStatus", status);
  3. driver.executeScript("seetest:client.stopStepsGroup");

Python-

  1. driver.execute_script("seetest:client.startStepsGroup", group_name)
  2. driver.execute_script("seetest:client.setGroupStatus", status)
  3. driver.execute_script("seetest:client.stopStepsGroup")

C#-

  1. driver.ExecuteScript("seetest:client.startStepsGroup", groupName);
  2. driver.ExecuteScript("seetest:client.setGroupStatus", status);
  3. driver.ExecuteScript("seetest:client.stopStepsGroup");

JavaScript-

  1. driver.executeScript("seetest:client.startStepsGroup", groupName);
  2. driver.executeScript("seetest:client.setGroupStatus", status);
  3. driver.executeScript("seetest:client.stopStepsGroup");

Ruby-

  1. driver.execute_script("seetest:client.startStepsGroup", group_name)
  2. driver.execute_script("seetest:client.setGroupStatus", status)
  3. driver.execute_script("seetest:client.stopStepsGroup")

Practical Example

Imagine running an automated test with several steps validating various aspects of the application. If there are steps related to specific areas of the application, grouping those steps can improve report clarity.

For instance, in a banking application, the login process might involve several steps before proceeding to the payment process. By grouping the login steps, you can easily identify the success or failure of the login process based on the group status.

Without grouping, a login scenario might look like this in your script:

wait.until(ExpectedConditions.elementToBeClickable(By.xpath(LOGIN_LOGO)));

driver.findElement(By.xpath(USERNAME_TEXTFIELD)).sendKeys(username);
driver.findElement(By.xpath(PASSWORD_TEXTFIELD)).sendKeys(password);

driver.findElement(By.xpath(LOGIN_BUTTON)).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(BALANCE_AMOUNT)));

With grouping functions, the scenario would be written as follows:

driver.executeScript("seetest:client.startStepsGroup", "Login_Steps");

wait.until(ExpectedConditions.elementToBeClickable(By.xpath(LOGIN_LOGO)));

driver.findElement(By.xpath(USERNAME_TEXTFIELD)).sendKeys(username);
driver.findElement(By.xpath(PASSWORD_TEXTFIELD)).sendKeys(password);

driver.findElement(By.xpath(LOGIN_BUTTON)).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(BALANCE_AMOUNT)));

driver.executeScript("seetest:client.setGroupStatus", "Passed");
driver.executeScript("seetest:client.stopStepsGroup");

Once the grouping functions are used, the test reports will display the groups as collapsible sections, making it easier to identify which group Passed or Failed.

note

You can create as many groups as needed in your test. However, each group requires a start and stop function before a new group can begin. Groups cannot be nested within each other.