forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
29 lines (23 loc) · 737 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package test
import (
"fmt"
"testing"
"path/filepath"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/reporters"
. "github.com/onsi/gomega"
)
var (
// JUnitOutDir grabs the root of the git path from Makefile
JUnitOutDir = ""
)
// RunSpecsWithReporters bootstraps Ginkgo/Gomega tests to function and results go to the /test/junit directory and log output
func RunSpecsWithReporters(t *testing.T, junitprefix string, suitename string) {
RegisterFailHandler(Fail)
if JUnitOutDir == "" {
RunSpecs(t, suitename)
return
}
junitReporter := reporters.NewJUnitReporter(filepath.Join(JUnitOutDir, fmt.Sprintf("%s-junit.xml", junitprefix)))
RunSpecsWithDefaultAndCustomReporters(t, suitename, []Reporter{junitReporter})
}