> For the complete documentation index, see [llms.txt](https://docs.liquidswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidswap.com/integration/unit-testing.md).

# Unit Testing

This part explains how to write unit tests during integration with Liquidswap Smart Contracts.

### Testing integration

To be able to run tests, you need to prepare the Liquidswap state in your test. There's a couple of utilities available to help you with that:

* `public fun initialize_liquidity_pool()` \[[source](https://github.com/pontem-network/liquidswap/blob/main/sources/test_helpers/test_pool.move#L30)]

It correctly initialize both Liquidswap and `LP<X, Y, Curve>` token of the Liquidswap. That process is pretty involved, so we provide this helper function to make it easier. Run it after the `genesis::setup()` call from Aptos Framework.

* `public fun mint_liquidity<X, Y, Curve>(lp_owner: &signer, coin_x: Coin<X>, coin_y: Coin<Y>): u64` \[[source](https://github.com/pontem-network/liquidswap/blob/main/sources/test_helpers/test_pool.move#L54)]

Adds `coin_x`, `coin_y` to the pool, and automatically deposits returning lp coins to the `lp_owner` account, handling the edge cases.

An example of the test would be:

{% embed url="<https://gist.github.com/borispovod/41d239593acd6d1b8b1f4ad5110ae130>" %}
Example of unit test
{% endembed %}

#### More examples

To learn Unit Tests more look at our Liquidswap [Unit Tests](https://github.com/pontem-network/liquidswap/tree/main/tests) and [Test Helpers](https://github.com/pontem-network/liquidswap/tree/main/sources/test_helpers).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.liquidswap.com/integration/unit-testing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
