コード例 #1
0
ファイル: default_reporter_test.go プロジェクト: hail100/cli
import (
	. "github.com/onsi/ginkgo"
	"github.com/onsi/ginkgo/config"
	"github.com/onsi/ginkgo/reporters"
	st "github.com/onsi/ginkgo/reporters/stenographer"
	"github.com/onsi/ginkgo/types"
	. "github.com/onsi/gomega"
	"time"
)

var _ = Describe("DefaultReporter", func() {
	var (
		reporter       *reporters.DefaultReporter
		reporterConfig config.DefaultReporterConfigType
		stenographer   *st.FakeStenographer

		ginkgoConfig config.GinkgoConfigType
		suite        *types.SuiteSummary
		spec         *types.SpecSummary
	)

	BeforeEach(func() {
		stenographer = st.NewFakeStenographer()
		reporterConfig = config.DefaultReporterConfigType{
			NoColor:           false,
			SlowSpecThreshold: 0.1,
			NoisyPendings:     true,
			Verbose:           true,
			FullTrace:         true,
		}
コード例 #2
0
		return New("description", beforeSuiteNode, spec.NewSpecs(specs), afterSuiteNode, []reporters.Reporter{reporter1, reporter2}, writer, config)
	}

	BeforeEach(func() {
		reporter1 = reporters.NewFakeReporter()
		reporter2 = reporters.NewFakeReporter()
		writer = Writer.NewFake()
		failer = Failer.New()

		thingsThatRan = []string{}
	})

	Describe("Running and Reporting", func() {
		var specA, pendingSpec, anotherPendingSpec, failedSpec, specB, skippedSpec *spec.Spec
		var willRunCalls, didCompleteCalls []string
		var conf config.GinkgoConfigType

		JustBeforeEach(func() {
			willRunCalls = []string{}
			didCompleteCalls = []string{}
			specA = newSpec("spec A", noneFlag, false)
			pendingSpec = newSpec("pending spec", pendingFlag, false)
			anotherPendingSpec = newSpec("another pending spec", pendingFlag, false)
			failedSpec = newSpec("failed spec", noneFlag, true)
			specB = newSpec("spec B", noneFlag, false)
			skippedSpec = newSpec("skipped spec", noneFlag, false)
			skippedSpec.Skip()

			reporter1.SpecWillRunStub = func(specSummary *types.SpecSummary) {
				willRunCalls = append(willRunCalls, "Reporter1")
			}
コード例 #3
0
func init() {
	Describe("Example Collection", func() {
		var (
			fakeT *fakeTestingT
			fakeR *fakeReporter

			examplesThatWereRun []string

			collection *exampleCollection
		)

		exampleWithItFunc := func(itText string, flag flagType, fail bool) *example {
			return newExample(newItNode(itText, func() {
				examplesThatWereRun = append(examplesThatWereRun, itText)
				time.Sleep(time.Duration(0.001 * float64(time.Second)))
				if fail {
					collection.fail(failureData{
						message: itText + " Failed",
					})
				}
			}, flag, types.GenerateCodeLocation(0), 0))
		}

		BeforeEach(func() {
			fakeT = &fakeTestingT{}
			fakeR = &fakeReporter{}
			examplesThatWereRun = make([]string, 0)
		})

		Describe("shuffling the collection", func() {
			BeforeEach(func() {
				collection = newExampleCollection(fakeT, "collection description", []*example{
					exampleWithItFunc("C", flagTypeNone, false),
					exampleWithItFunc("A", flagTypeNone, false),
					exampleWithItFunc("B", flagTypeNone, false),
				}, []Reporter{fakeR}, config.GinkgoConfigType{})
			})

			It("should be sortable", func() {
				sort.Sort(collection)
				collection.run()
				Ω(examplesThatWereRun).Should(Equal([]string{"A", "B", "C"}))
			})

			It("shuffles all the examples after sorting them", func() {
				collection.shuffle(rand.New(rand.NewSource(17)))
				collection.run()
				Ω(examplesThatWereRun).Should(Equal(shuffleStrings([]string{"A", "B", "C"}, 17)), "The permutation should be the same across test runs")
			})
		})

		Describe("reporting to multiple reporter", func() {
			var otherFakeR *fakeReporter
			BeforeEach(func() {
				otherFakeR = &fakeReporter{}

				collection = newExampleCollection(fakeT, "collection description", []*example{
					exampleWithItFunc("C", flagTypeNone, false),
					exampleWithItFunc("A", flagTypeNone, false),
					exampleWithItFunc("B", flagTypeNone, false),
				}, []Reporter{fakeR, otherFakeR}, config.GinkgoConfigType{})
				collection.run()
			})

			It("reports to both reporters", func() {
				Ω(otherFakeR.beginSummary).Should(Equal(fakeR.beginSummary))
				Ω(otherFakeR.endSummary).Should(Equal(fakeR.endSummary))
				Ω(otherFakeR.exampleSummaries).Should(Equal(fakeR.exampleSummaries))
			})
		})

		Describe("running an example collection", func() {
			var (
				example1 *example
				example2 *example
				example3 *example
				conf     config.GinkgoConfigType
			)
			BeforeEach(func() {
				conf = config.GinkgoConfigType{FocusString: "", ParallelTotal: 1, ParallelNode: 1}

				example1 = exampleWithItFunc("it 1", flagTypeNone, false)
				example2 = exampleWithItFunc("it 2", flagTypeNone, false)
				example3 = exampleWithItFunc("it 3", flagTypeNone, false)
			})

			JustBeforeEach(func() {
				collection = newExampleCollection(fakeT, "collection description", []*example{example1, example2, example3}, []Reporter{fakeR}, conf)
				collection.run()
			})

			Context("when all the examples pass", func() {
				It("runs all the tests", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"it 1", "it 2", "it 3"}))
				})

				It("marks the suite as passed", func() {
					Ω(fakeT.didFail).Should(BeFalse())
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(3))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleWillRunSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(3))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(3))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when examples fail", func() {
				BeforeEach(func() {
					example2 = exampleWithItFunc("failing it 2", flagTypeNone, true)
					example3 = exampleWithItFunc("failing it 3", flagTypeNone, true)
				})

				It("runs all the tests", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"it 1", "failing it 2", "failing it 3"}))
				})

				It("marks the suite as failed", func() {
					Ω(fakeT.didFail).Should(BeTrue())
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(3))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeFalse())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(3))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(1))
					Ω(summary.NumberOfFailedExamples).Should(Equal(2))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when examples are pending", func() {
				BeforeEach(func() {
					example1 = exampleWithItFunc("pending it 1", flagTypePending, false)
				})

				It("skips the pending examples", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"it 2", "it 3"}))
				})

				It("marks the suite as passed", func() {
					Ω(fakeT.didFail).Should(BeFalse())
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(1))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(1))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(2))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})

				Context("and --failOnPending is set", func() {
					BeforeEach(func() {
						conf.FailOnPending = true
					})

					It("should mark the suite as failed", func() {
						Ω(fakeT.didFail).Should(BeTrue())
						summary := fakeR.endSummary
						Ω(summary.SuiteSucceeded).Should(BeFalse())
					})
				})
			})

			Context("when examples are focused", func() {
				BeforeEach(func() {
					example1 = exampleWithItFunc("focused it 1", flagTypeFocused, false)
					example3 = exampleWithItFunc("focused it 3", flagTypeFocused, false)
				})

				It("skips the non-focused examples", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"focused it 1", "focused it 3"}))
				})

				It("marks the suite as passed", func() {
					Ω(fakeT.didFail).Should(BeFalse())
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(1))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(1))
					Ω(summary.NumberOfPassedExamples).Should(Equal(2))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when a regexp focusString is provided", func() {
				BeforeEach(func() {
					conf.FocusString = `collection description.*pickles\d$`
					example1 = exampleWithItFunc("focused it 1", flagTypeFocused, false)
					example2 = exampleWithItFunc("another it pickles2", flagTypeNone, false)
					example3 = exampleWithItFunc("focused it pickles3", flagTypeFocused, false)
				})

				It("ignores the programmatic focus and applies the regexp focusString", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"another it pickles2", "focused it pickles3"}))
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(1))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(1))
					Ω(summary.NumberOfPassedExamples).Should(Equal(2))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when a regexp skipString is provided", func() {
				BeforeEach(func() {
					conf.SkipString = `collection description.*pickles\d$`
					example1 = exampleWithItFunc("focused it 1", flagTypeFocused, false)
					example2 = exampleWithItFunc("another it pickles2", flagTypeNone, false)
					example3 = exampleWithItFunc("focused it pickles3", flagTypeFocused, false)
				})

				It("ignores the programmatic focus and applies the regexp skipString", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"focused it 1"}))
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(1))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(2))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(1))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(2))
					Ω(summary.NumberOfPassedExamples).Should(Equal(1))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when both a regexp skipString and focusString are provided", func() {
				BeforeEach(func() {
					conf.SkipString = `collection description.*2`
					conf.FocusString = `collection description.*A`
					example1 = exampleWithItFunc("A1", flagTypeFocused, false)
					example2 = exampleWithItFunc("A2", flagTypeNone, false)
					example3 = exampleWithItFunc("B1", flagTypeFocused, false)
				})

				It("ignores the programmatic focus and ANDs the focusString and skipString", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"A1"}))
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(1))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(2))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(3))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example1.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[2]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(3))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(1))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(2))
					Ω(summary.NumberOfPassedExamples).Should(Equal(1))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})

			Context("when a examples are run in parallel", func() {
				BeforeEach(func() {
					conf.ParallelTotal = 2
					conf.ParallelNode = 2
				})

				It("trims the example set before running them", func() {
					Ω(examplesThatWereRun).Should(Equal([]string{"it 2", "it 3"}))
				})

				It("publishes the correct starting suite summary", func() {
					summary := fakeR.beginSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(2))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(0))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime).Should(Equal(time.Duration(0)))
				})

				It("publishes the correct example summaries", func() {
					Ω(fakeR.exampleSummaries).Should(HaveLen(2))
					Ω(fakeR.exampleSummaries[0]).Should(Equal(example2.summary()))
					Ω(fakeR.exampleSummaries[1]).Should(Equal(example3.summary()))
				})

				It("publishes the correct ending suite summary", func() {
					summary := fakeR.endSummary
					Ω(summary.SuiteDescription).Should(Equal("collection description"))
					Ω(summary.SuiteSucceeded).Should(BeTrue())
					Ω(summary.NumberOfExamplesBeforeParallelization).Should(Equal(3))
					Ω(summary.NumberOfTotalExamples).Should(Equal(2))
					Ω(summary.NumberOfExamplesThatWillBeRun).Should(Equal(2))
					Ω(summary.NumberOfPendingExamples).Should(Equal(0))
					Ω(summary.NumberOfSkippedExamples).Should(Equal(0))
					Ω(summary.NumberOfPassedExamples).Should(Equal(2))
					Ω(summary.NumberOfFailedExamples).Should(Equal(0))
					Ω(summary.RunTime.Seconds()).Should(BeNumerically("~", 3*0.001, 0.01))
				})
			})
		})

		Describe("measurements", func() {
			exampleWithMeasure := func(text string) *example {
				return newExample(newMeasureNode(text, func(b Benchmarker) {
					examplesThatWereRun = append(examplesThatWereRun, text)
				}, flagTypeNone, types.GenerateCodeLocation(0), 1))
			}

			var conf config.GinkgoConfigType

			BeforeEach(func() {
				conf = config.GinkgoConfigType{}
			})

			JustBeforeEach(func() {
				collection = newExampleCollection(fakeT, "collection description", []*example{
					exampleWithItFunc("C", flagTypeNone, false),
					exampleWithItFunc("A", flagTypeNone, false),
					exampleWithItFunc("B", flagTypeNone, false),
					exampleWithMeasure("measure"),
				}, []Reporter{fakeR}, conf)

				collection.run()
			})

			It("runs the measurement", func() {
				Ω(examplesThatWereRun).Should(ContainElement("A"))
				Ω(examplesThatWereRun).Should(ContainElement("measure"))
			})

			Context("when instructed to skip measurements", func() {
				BeforeEach(func() {
					conf = config.GinkgoConfigType{
						SkipMeasurements: true,
					}
				})

				It("skips the measurements", func() {
					Ω(examplesThatWereRun).Should(ContainElement("A"))
					Ω(examplesThatWereRun).ShouldNot(ContainElement("measure"))
				})
			})
		})
	})
}