Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute before and after for each spec #2299

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions execution/simpleExecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,8 @@ func (e *simpleExecution) executeSpecs(sc *gauge.SpecCollection) (results []*res
specs := sc.Next()
var preHookFailures, postHookFailures []*gauge_messages.ProtoHookFailure
var specResults []*result.SpecResult
var before, after = true, false
for i, spec := range specs {
if i == len(specs)-1 {
after = true
}
res := newSpecExecutor(spec, e.runner, e.pluginHandler, e.errMaps, e.stream).execute(before, preHookFailures == nil, after)
before = false
for _, spec := range specs {
res := newSpecExecutor(spec, e.runner, e.pluginHandler, e.errMaps, e.stream).execute(true, preHookFailures == nil, true)
specResults = append(specResults, res)
preHookFailures = append(preHookFailures, res.GetPreHook()...)
postHookFailures = append(postHookFailures, res.GetPostHook()...)
Expand Down