示例#1
0
func TestCloudConfig(t *testing.T) {
	RegisterFailHandler(Fail)
	if os.Getenv("TEAMCITY") == "true" {
		RunSpecsWithCustomReporters(t, "CloudConfig Test Suite", []Reporter{reporters.NewTeamCityReporter(os.Stdout)})
	} else {
		RunSpecs(t, "CloudConfig Test Suite")
	}
}
示例#2
0
func TestLogger(t *testing.T) {
	RegisterFailHandler(Fail)
	if os.Getenv("TEAMCITY") == "true" {
		RunSpecsWithCustomReporters(t, suite, []Reporter{reporters.NewTeamCityReporter(os.Stdout)})
	} else {
		RunSpecs(t, suite)
	}
}
示例#3
0
func TestCache(t *testing.T) {
	flag.Parse()

	RegisterFailHandler(Fail)
	if *tcReport {
		RunSpecsWithCustomReporters(t, "Cache Suite", []Reporter{reporters.NewTeamCityReporter(os.Stdout)})
	} else {
		RunSpecs(t, "Cache Suite")
	}
}
	"github.com/onsi/ginkgo/config"
	"github.com/onsi/ginkgo/reporters"
	"github.com/onsi/ginkgo/types"
	. "github.com/onsi/gomega"
	"time"
)

var _ = Describe("TeamCity Reporter", func() {
	var (
		buffer   bytes.Buffer
		reporter Reporter
	)

	BeforeEach(func() {
		buffer.Truncate(0)
		reporter = reporters.NewTeamCityReporter(&buffer)
		reporter.SpecSuiteWillBegin(config.GinkgoConfigType{}, &types.SuiteSummary{
			SuiteDescription:              "Foo's test suite",
			NumberOfExamplesThatWillBeRun: 1,
		})
	})

	Describe("a passing test", func() {
		BeforeEach(func() {
			example := &types.ExampleSummary{
				ComponentTexts: []string{"[Top Level]", "A", "B", "C"},
				State:          types.ExampleStatePassed,
				RunTime:        5 * time.Second,
			}
			reporter.ExampleWillRun(example)
			reporter.ExampleDidComplete(example)