Commits

Miki Tebeka  committed b4321c8

Parallel test example

  • Participants
  • Parent commits 27d1ad4

Comments (0)

Files changed (1)

File parallel_test.go

+// Small example on how to run tests in parallel
+// To run the tests, execute "gotest --parallel 10 -v"
+package parallel
+
+import (
+	"testing"
+	"time"
+)
+
+func TestOne(t *testing.T) {
+	t.Parallel()
+	time.Sleep(2*1e9)
+}
+
+func TestTwo(t *testing.T) {
+	t.Parallel()
+	time.Sleep(2*1e9)
+}
+
+// This test is not parallel, it will run before the previous two
+func TestThree(t *testing.T) {
+	t.Fatal("OUCH")
+}
+