> For the complete documentation index, see [llms.txt](https://docs.dogq.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dogq.io/documentation/macros.md).

# Macros

### What is Macro

Macros are pre-defined sets of test steps that can be shared across multiple Scenarios. In other words they are reusable chunks of tests that you can plug into as many Scenarios as you need. A typical example is creating a "precondition" step, e.g., logging in with a specific user before executing the rest of the steps, i.e. the actual test.

Changes made to a Macro will be reflected in all the Scenarios it is used in, allowing for great flexibility and speed when creating a large number of tests. Proactively using Macros make your tests more modular and readable, enabling you to make adjustments to your Scenarios on the fly by simply moving blocks around.&#x20;

### Creating a new Macro

There is a dedicated **Macros** [page](https://dogq.io/macros) you can access from the sidebar. It contains a list of all the Macros you and any Team member have created, making it a Macros management tool.

Here you can create a new Macro by clicking on the <img src="/files/cTiW6nElmin3oLicrxOQ" alt="" data-size="line"> button and specifying a Name.

<figure><img src="/files/XtuGiSIx35nPsIh8tdkJ" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Optionally, you can **bind** the new Macro to a Project, which means that you will only be able to use it inside that Project. This will allow you to use filters when managing your Macros, once you have a large number of them.
{% endhint %}

Inside the new Macro you can add and configure the Scenario steps, just like you would in the Test Editor.

<figure><img src="/files/DoBRxRHOpI9cZqBqiXZz" alt=""><figcaption></figcaption></figure>

After that, you can add this set of steps to any Scenario with the **Use Macro** step.

<figure><img src="/files/Zlr5FMx12uFxi5wmBW2X" alt=""><figcaption></figcaption></figure>

### New Macro from Scenario &#x20;

You can also use the Actions dropdown menu <img src="/files/mCR1pUVAozMnx0uPc0Bz" alt="" data-size="line"> right in the Test Editor. Select the **Create Macro** action to copy the steps from your Scenario into a new Macro.&#x20;

<figure><img src="/files/pyyQzzpO2pL4efrVXp3l" alt=""><figcaption></figcaption></figure>
