Can I run a single test in a suite?

Schultz9999 picture Schultz9999 · Nov 5, 2016 · Viewed 9.1k times · Source

I have setup a test suite for my struct (https://github.com/stretchr/testify#suite-package). Before I was able to run a single test by specifying just a pattern:

go test -v ./services/gateways/... -run mytest

This approach doesn't work after conversion. Bad luck or is there a way?

Answer

Andy McCall picture Andy McCall · Apr 10, 2017

You can run single methods by specifying the -testify.m argument.

to run this suite method the command is:

go test -v github.com/vektra/mockery/mockery -run ^TestGeneratorSuite$ -testify.m TestGenerator