---
title: Set up test projects
related:
  - https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-unit-tests.md
  - https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-integration-tests.md
  - https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-isolated-integration-tests.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

[Automated tests](https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests.md) typically mirror the structure of the tested code. We recommend creating at least one test project for every custom project in your Xperience solution. You can have any number of test projects in the solution.

## Create a test project

[Add a class library](https://docs.kentico.com/documentation/developers-and-admins/customization/integrate-custom-code.md) to your Xperience solution for the test project. When setting up the project:

- Name the project with a **.Tests** suffix (for example, `MyCustomCode.Tests`).

- Install the **Kentico.Xperience.Core.Tests** NuGet package.

  ```bash
  dotnet add package Kentico.Xperience.Core.Tests
  ```

- Add references from the test project to all projects whose code you want to test.

> **Note:** The `Kentico.Xperience.Core.Tests` package depends on an exact version of `Kentico.Xperience.Core`. Always install the same version of the test package as the Xperience version used by the rest of your solution, and update both together.

## Additional packages

All functionality in the _CMS.Tests_ library is compatible with the [NUnit](https://docs.nunit.org/) testing framework.

The package does **not** include a test runner or a mocking library.

Add the following test infrastructure packages to your test project. These packages enable test discovery and execution via `dotnet test`, which runs your tests from the command line without any IDE, as well as in IDE test runners such as Visual Studio Test Explorer and Rider:

- **NUnit3TestAdapter** – test runner for `dotnet test`, Visual Studio, and Rider
- **Microsoft.NET.Test.Sdk** – test platform infrastructure

For test doubles (fakes) of other service dependencies, you can add a mocking library of your choice (for example [Moq](https://github.com/devlooped/moq), [NSubstitute](https://nsubstitute.github.io/), or [FakeItEasy](https://fakeiteasy.github.io/)), or use hand-written fakes and stubs.

With your test project ready, you can start writing test classes. To choose an approach, see [unit tests with faked data](https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-unit-tests.md), [integration tests](https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-integration-tests.md), or [isolated integration tests](https://docs.kentico.com/documentation/developers-and-admins/customization/write-automated-tests/create-isolated-integration-tests.md). Use the Visual Studio Test Explorer or `dotnet test` to execute your tests.
