Пример #1
0
// rootConvey is the main entry point to a test suite. This is called when
// there's no context in the stack already, and items must contain a `t` object,
// or this panics.
func rootConvey(items ...interface{}) {
	entry := discover(items)

	if entry.Test == nil {
		conveyPanic(missingGoTest)
	}

	expectChildRun := true
	ctx := &context{
		reporter: buildReporter(),

		children: make(map[string]*context),

		expectChildRun: &expectChildRun,

		focus:       entry.Focus,
		failureMode: defaultFailureMode.combine(entry.FailMode),
	}
	ctxMgr.SetValues(gls.Values{nodeKey: ctx}, func() {
		ctx.reporter.BeginStory(reporting.NewStoryReport(entry.Test))
		defer ctx.reporter.EndStory()

		for ctx.shouldVisit() {
			ctx.conveyInner(entry.Situation, entry.Func)
			expectChildRun = true
		}
	})
}
Пример #2
0
func (self *runner) Begin(entry *registration) {
	self.active = self.top
	self.focus = entry.Focus

	self.ensureStoryCanBegin()
	self.reporter.BeginStory(reporting.NewStoryReport(entry.Test))
	self.Register(entry)
}
Пример #3
0
func (self *runner) Run(entry *registration) {
	self.active = self.top
	self.focus = entry.Focus
	self.failureMode = defaultFailureMode

	self.Register(entry)
	self.reporter.BeginStory(reporting.NewStoryReport(entry.Test))

	for !self.top.visited() {
		self.top.visit(self)
	}

	self.reporter.EndStory()
}