---
title: "Unit Testing Pulumi programs in Go"
description: "An example that applies unit testing to Go and AWS resources."
url: "https://www.pulumi.com/dev/examples/testing-unit-go/"
image: "https://www.pulumi.com/assets/og/dev/examples/testing-unit-go.png"
---

# Unit Testing Pulumi programs in Go

An example that applies unit testing to Go and AWS resources.

- Source on GitHub: https://github.com/pulumi/examples/tree/master/testing-unit-go

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/testing-unit-go) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set testing-unit-go
cd pulumi-examples/testing-unit-go
```

An example of writing mock-based unit tests with both infrastructure definition and tests written in Go.

## Prerequisites

[Install Go](https://golang.org/doc/install).

## Running the tests

2.  Run the tests:

    ```
    $ go test

    PASS
    ok  	testing-unit-go	0.400s
    ```

## Further steps

Learn more about testing Pulumi programs:

- [Testing Guide](https://www.pulumi.com/docs/guides/testing/)
- [Unit Testing Guide](https://www.pulumi.com/docs/guides/testing/unit/)
