Skip to content

Golang: How to run only a specific test?

In Golang, we have lots of flags that can help us during running and testing software.

By adding -run to your test command you can specify the name of the test you want to run.

Run the tests if they have a specific string in their name (match):

go test -run NameOfTheTest

Run the test if it has only the given name:

go test -run "^NameOfTest$" 
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *