> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/unit-tests.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Creating unit tests for code using FME SDKs

Learn how to create unit tests on your code programmatically using the Admin API.

If your development environment requires unit tests, we recommend running tests on your code that is integrated to Split SDK for all possible treatments values returned from SDK's `getTreatment` call. The SDK `Localhost` mode is the best option to achieve this while keeping your code integrated to the SDK.

Each SDK language supports localhost mode, which reads the feature flag names and their treatments from a local YAML file, instead of connecting to FME cloud. This enables the creation of multiple YAML files, each with unique treatment values, to cycle through all the possible treatments returned from each Split.

As mentioned above, using localhost mode does not require any network connection to FME cloud and will not write any Impressions records to the FME account, making the unit test runs smooth.

![](https://1473625385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrT2RGHAjtBTaObzchfpb%2Fuploads%2Fgit-blob-2f9eb9b577fe088152007e864be808548d0463dc%2Funit-test-diagram.png?alt=media)

Go to [Export Feature Flag Treatments to a YAML File](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/examples/export-treatments.md) to automatically create YAML files containing feature flag names and treatments from a given feature flag list.

## Next steps

* Go to [Test automation in QA](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/test-automation.md) to use test automation tools in your QA process.
* Go to [Export feature flag treatments to a YAML file](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/examples/export-treatments.md) to export feature flag treatments to a YAML file.

{% @harness-feedback/feedback %}
