# Step groups

> Save a sequence of steps once and call it from any test case, make it data-driven, nest groups up to 3 levels, and reuse groups across projects.

A step group is a sequence of steps saved once and called from any test case. Logging in comes before a fund transfer, before deleting a beneficiary, and before downloading a statement, so the login steps belong in a step group rather than in all three test cases.

Editing the group changes every test case that calls it.

## Create a step group

1. Go to **Create Tests > Step Groups** and click **Create Step Group**.

2. Enter a **Name**.

3. Click **Add new step** and write the steps, or click **Record** to record them.

The group is ready to use in any test case as soon as its steps exist.

## Create a step group from a test case

Select the steps in an open test case, and click **Create Step Group** in the option bar that appears above them. Enter a name, then choose what happens to the steps you selected:

- **Create** builds the group and leaves the test case as it is
- **Create and Replace** builds the group and swaps the selected steps for a call to it

![The Create Step Group dialog over selected steps, with Create and Create and Replace](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/Step_Group_Confirmation.png)

**Create and Replace** appears only when the steps you selected are consecutive.

## Use a step group in a test case

1. Open the test case.

2. Click the option on the left of a step and select **Step Group**.

3. Select the group from the **Step Group** list overlay.

4. Click **Create Step**.

![The Step Group list overlay in a test case, listing the created step groups](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/Step_Group_Overlay.png)

## Use a step group from another project

1. Open the test case, click the option next to a step, and select **Step Group**.

2. Click **Reuse Step Group** in the list overlay.

3. Select the **project**, **application**, and **version**.

4. Select the group from the **Reuse Step Group** dropdown.

5. Click **Create Step**.

A step group reused across application types can carry element locators that do not match the target application. Check and update the locators before you run the test case.

## Create a data-driven step group

A data-driven step group iterates a test data profile of its own, separately from the test case that calls it.

1. Create the step group and click **Step Group Settings**.

2. Select the **Test Data Profile** to associate with the group.

3. Turn on **Data Driven**.

4. Create the steps.

![Step Group Settings, with a test data profile selected and Data Driven on](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/Step_Group_Data_Driven_Toggle.png)

A data-driven step group can be called from a data-driven test case. The group then iterates its own data sets on every iteration of the test case.

Two more things work on the iteration count inside a group. The `Store` NLP saves the current iteration count into a variable for later use. Data set values from the iterated profile can be compared inside an if condition, through the String Compare add-on.

## Nest step groups

A step group can contain another step group, up to 3 levels, in both a test case and a step group.

In a test case, select the steps, click **Create Step Group**, enter a **Name**, and click **Create and Replace**.

In a step group, create the steps first, select the ones to nest, then enter a **Name** and click **Create and Replace**.

## Edit a step group

Go to **Create Tests > Step Groups**, open the group, and make the changes.

The changes reach every test case that uses the group.

To change a group for one test case only, open that test case, expand the step group, and edit the test data or the element on a step. Click **Update Step** to save.

Inside a test case you can edit test data and elements, but not the NLP. These edits stay in that test case and leave the original group untouched.

## Label a step group

Open the group and select the labels under **Manage Step Group > Labels**.

To create a label, go to **Settings > Labels**, click **Add New Label**, enter a name, and click the tick mark icon. For more details on labels, see [Label test cases](https://testsigma.com/docs/v2/create-and-manage/create-test-cases/#label-test-cases).

## Delete a step group

1. On the **Step Groups** list page, click the ellipsis icon (⋮) next to the group and click **Delete**.

2. Read the affected test cases listed in **Deletion Warning**.

3. Enter `DELETE` and click **I understand, delete this Step Group**.

Deleting a group removes it from every test case linked to it.
