# Create defects during test execution with AI Copilot

When running a test, you can quickly create a defect the moment you notice a problem. Once you mark a step as failed or blocked, the system will offer you the option to generate a defect with AI Copilot. The AI will use all available information from your test case and test execution to create a complete and detailed defect for you.\
This saves time and reduces manual effort while ensuring consistent and high quality defect reporting.

How to start:

* Open a test case and start a test run.
* Follow the test steps as usual.
* When you find an issue during a step:
  * Enter the **actual result**
  * Attach any screenshots if needed
  * Select **Fail** or **Blocked** for the step

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

After marking the step as **Failed** or **Blocked**, a notification will appear suggesting to create a defect with AI Copilot.

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

Click **Create with AI.** AI Copilot gathers all relevant information automatically:

* Test case title and ID
* Step description
* Expected result
* Actual result you entered
* Any attachments you added
* Context from the execution

The system generates a complete defect draft that includes background information, steps to reproduce, actual and expected results.

You will see a preview window with the proposed defect. You can:

* Read the full content
* Regenerate the defect
* Cancel if you do not want to proceed
* Save when it looks correct

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

<figure><img src="/files/0wLxg15fR9CJIskeeJ3k" alt=""><figcaption></figcaption></figure>

When you save:

* A new defect is created
* It is automatically linked to the test execution

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

* It is also automatically linked to the original test case
* Any files added during the execution are included in the defect
* You can continue your test run


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aqua-cloud.io/documentation/ai-copilot/create-defects-during-test-execution-with-ai-copilot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
