> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing

> Guide to setting up and running integration tests for bookmarks in Atoti FRTB, with samples for custom integration tests and a unit test overview

This section explains how to set up and run integration tests for
bookmarks, provides samples for custom integration tests and an outline of
unit tests.

There are a number of (unit and integration) tests across the project in
each of the modules.

## Integration tests

By default, the integration tests are not executed during the project
build. The reason for this is that they significantly increase the build
time.

There is a separate Maven profile called `IT` that can be run with the
following command to execute the integration tests:

  `mvn install -P IT`.

### Bookmark tests

Atoti FRTB  uses a test harness library which has been
developed to regression test Atoti Server projects. This library makes it
possible to start up a cube, execute MDX queries and assert the values match.

By default, the Atoti Server instance will load data
from */src/test/resources/data*.

#### Creating bookmark (MDX) tests

1. Start up the Atoti Server instance.
2. Run the
   class `com.activeviam.back.test.bookmark.creator.BookmarkTestCreatorRunner` -
   This will create a set of files in the folder with MDX queries
   in */src/test/resources/test-bookmarks*. All of the MDX queries
   will be stored in files ending with *.query*.
3. Stop the Atoti Server instance.

#### Creating/Replacing Expected Results

Run the class `com.activeviam.back.test.ReferenceRegressionTestIT` as a
Java application - This will startup an Atoti Server instance, execute
the queries in */src/test/resources/test-bookmarks* and store the
results in files ending with *.csv*.

#### Executing Bookmark (MDX) Tests

Run the class `com.activeviam.back.test.ReferenceRegressionTestIT` as a
JUnit test - This will startup an Atoti Server instance, execute the
queries in the files ending with .*query* and assert the results against
the corresponding file ending with .*csv*.

## Custom integration tests

Integration tests can be defined fully in code, this includes things
such as sample data being injected into the Atoti Server instance, the
query being executed together with the expected values.

There are a number of sample integration tests in the reference
implementation that have been defined as examples. An abstract class is
available as a starting point for integration tests being defined
manually. See the class `com.activeviam.frtb.it.AIntegrationTestIT`.

Example implementations of this class can be found in the reference
implementation.

## Unit tests

By default, unit tests are executed when running `mvn install`. Some
example tests can be found in the reference implementation where
datastores have been created and mocked in order to test certain
functionalities.
