# Test Tagging

## Tests Managed By Diffblue

Diffblue Cover identifies and manages generated tests by either: specific tags or the class the tests belong to. The exact conditions are listed below:

* The tests are tagged with `@ManagedByDiffblue` annotations (introduced in Cover annotations 1.4.0).
* The tests are tagged with `@Tag("MaintainedByDiffblue")` annotations (from Cover annotations 1.3.0).
* The tests are untagged, but reside within **DiffblueTest Classes** (whose naming convention can be configured; see [class-name-template](/features/cover-cli/commands-and-arguments.md#class-name-template)).

{% hint style="info" %}
Note: Support for `@Tag("MaintainedByDiffblue")` is deprecated, and will be dropped in a future release. We recommend updating to the latest version of Cover Annotations to ensure continued support for your Diffblue Tests.\
See [Cover Annotations](/features/cover-annotations.md).
{% endhint %}

This designation means that Diffblue Cover can **overwrite, modify, or remove** these tests. For example, you can [maintain Diffblue tests](/features/cover-cli/commands-and-arguments.md#test-maintenance-validate-clean-and-remove) using commands like `dcover remove`, `dcover clean`, or `dcover validate`. These tests can also be overwritten and changed in future uses of `dcover create` if their associated method is modified.

Here's an example of a tagged Diffblue Test:

```java
  @Test
  @ManagedByDiffblue
  @Tag("ContributionFromDiffblue")
  void testAdd_whenOne_thenReturnThree() {
    // Arrange, Act and Assert
    assertEquals(3, new Calculator().add(1, 2));
  }

```

## Tests that Contribute to Diffblue Coverage

Tests that Diffblue Cover has helped create (i.e. tests that have had a contribution from Diffblue Cover) will be included in the measurement of Diffblue Coverage if they are either:

* Tagged with an `@Tag("ContributionFromDiffblue")` annotation.
* Tagged with an `@Tag("MaintainedByDiffblue")` annotation (which also served this purpose).
* Untagged, but reside within a **DiffblueTest class**.

This ensures that the coverage generated by these specific tests is accurately categorized as "Diffblue Coverage" in your reports.

## How Test Tags are Applied and Managed

Test tagging annotations are automatically added by Diffblue Cover when tests are generated; there is no need to manually apply or adjust these annotations.

When a test is edited and should no longer be considered a Diffblue test, consider removing the `@ManagedByDiffblue`annotation. This ensures that the manual changes are preserved and not overwritten during future uses of `dcover create`.

The tags `@Tag("ContributionFromDiffblue")` or `@Tag("MaintainedByDiffblue)` should not be removed or adjusted, doing so will lead to an invalidation of Diffblue test coverage output. .


---

# 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://cover-docs-preview.diffblue.com/features/cover-annotations/test-tagging.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.
