Skip to content

Instantly share code, notes, and snippets.

@sagikazarmark
Created April 2, 2021 17:48
Show Gist options
  • Save sagikazarmark/b7979797d9f9074d373bb4d1241d798b to your computer and use it in GitHub Desktop.
Save sagikazarmark/b7979797d9f9074d373bb4d1241d798b to your computer and use it in GitHub Desktop.
Go integration tests
package main
func TestIntegration(t *testing.T) {
if m := flag.Lookup("test.run").Value.String(); m == "" || !regexp.MustCompile(m).MatchString(t.Name()) {
t.Skip("skipping integration test as execution was not requested explicitly using go test -run")
}
t.Run("testCase", testCase)
// or
testIntegration(t)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment