# Test observability

### Why use observability with tests

Tests can be a great source of observability. The ability to study the application in a controlled experiment, changing only the code each time - is a huge opportunity to uncover issues and study how the system behaves.

In practical terms, this means that Digma creates a two-way mapping between the test of each asset - database query, endpoint, code location, or consumer. From the test level, you can identify issues and study system analytics under the test environment.

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

Interestingly, from the scope of each asset, you can see which tests are triggering it, as well as any related insights and traces.

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

### Running tests in the IDE

When you run your integration or end-to-end tests in the IDE, Digma will automatically pick up on that to add observability to each test context. Assuming that the Observability Toggle is turned on, Digma will wrap each test in a trace and begin to analyze which assets were called and how they performed.

### Connecting your CI tests with Digma

Follow the instructions for instrumenting your app in CI as documented [here](/digma-developer-guide/instrumentation/java/spring-spring-boot-dropwizard-and-default/instrumenting-your-code-in-ci-staging-or-the-terminal.md).

You should create unique [environments](/digma-developer-guide/digma-core-concepts/environments.md) for different test types, to avoid data anomalies and maintain consistency in the analytics.


---

# 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.digma.ai/digma-developer-guide/digma-features/test-observability.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.
