Skip to content

Commit

Permalink
Merge branch 'master' into format-concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrNestor committed Jul 4, 2024
2 parents e229ef9 + fd4af9f commit 9bd969b
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 52 deletions.
34 changes: 17 additions & 17 deletions build/npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"homepage": "https://github.com/getgauge/gauge#readme",
"devDependencies": {
"chai": "^5.1.1",
"mocha": "^10.4.0",
"mocha": "^10.5.2",
"sinon": "^18.0.0"
},
"dependencies": {
"adm-zip": "^0.5.12"
"adm-zip": "^0.5.14"
}
}
18 changes: 9 additions & 9 deletions build/pip/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
bleach==6.1.0
certifi==2024.2.2
certifi==2024.6.2
charset-normalizer==3.3.2
docutils==0.21.2
idna==3.7
importlib-metadata==7.1.0
importlib-metadata==8.0.0
jaraco.classes==3.4.0
keyring==25.2.1
markdown-it-py==3.0.0
mdurl==0.1.2
more-itertools==10.2.0
pkginfo==1.10.0
more-itertools==10.3.0
pkginfo==1.11.1
Pygments==2.18.0
readme-renderer==43.0
requests==2.32.1
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.7.1
setuptools==69.5.1
setuptools==70.2.0
six==1.16.0
twine==5.1.0
urllib3==2.2.1
twine==5.1.1
urllib3==2.2.2
webencodings==0.5.1
zipp==3.18.2
zipp==3.19.2
8 changes: 8 additions & 0 deletions execution/result/scenarioResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ func (s ScenarioResult) GetFailed() bool {
return s.ProtoScenario.GetExecutionStatus() == gauge_messages.ExecutionStatus_FAILED
}

func (s ScenarioResult) SetSkippedScenario() {
s.ProtoScenario.ExecutionStatus = gauge_messages.ExecutionStatus_SKIPPED
}

func (s ScenarioResult) GetSkippedScenario() bool {
return s.ProtoScenario.GetExecutionStatus() == gauge_messages.ExecutionStatus_SKIPPED
}

func (s ScenarioResult) AddItems(protoItems []*gauge_messages.ProtoItem) {
s.ProtoScenario.ScenarioItems = append(s.ProtoScenario.ScenarioItems, protoItems...)
}
Expand Down
4 changes: 4 additions & 0 deletions execution/result/stepResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func (s *StepResult) GetStepFailed() bool {
return s.StepFailed
}

func (s *StepResult) GetSkippedScenario() bool {
return s.ProtoStep.StepExecutionResult.ExecutionResult.GetSkipScenario()
}

// GetStackTrace returns the stacktrace for step failure
func (s *StepResult) GetStackTrace() string {
return s.ProtoStep.GetStepExecutionResult().GetExecutionResult().GetStackTrace()
Expand Down
40 changes: 38 additions & 2 deletions execution/scenarioExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,25 @@ func (e *scenarioExecutor) execute(i gauge.Item, r result.Result) {
}
e.notifyBeforeScenarioHook(scenarioResult)

if !scenarioResult.GetFailed() {
if !(scenarioResult.GetFailed() || scenarioResult.GetSkippedScenario()) {
protoContexts := scenarioResult.ProtoScenario.GetContexts()
protoScenItems := scenarioResult.ProtoScenario.GetScenarioItems()
// context and steps are not appended together since sometime it cause the issue and the steps in step list and proto step list differs.
// This is done to fix https://github.com/getgauge/gauge/issues/1629
if e.executeSteps(e.contexts, protoContexts, scenarioResult) {
e.executeSteps(scenario.Steps, protoScenItems, scenarioResult)
if !scenarioResult.GetSkippedScenario() {
e.executeSteps(scenario.Steps, protoScenItems, scenarioResult)
}
}
// teardowns are not appended to previous call to executeSteps to ensure they are run irrespective of context/step failure
e.executeSteps(e.teardowns, scenarioResult.ProtoScenario.GetTearDownSteps(), scenarioResult)
}

if scenarioResult.GetSkippedScenario() {
e.skippedScenarioUpdateErrMap(i, r)
setSkipInfoInResult(scenarioResult, scenario, e.errMap)
}

e.notifyAfterScenarioHook(scenarioResult)
scenarioResult.UpdateExecutionTime()
}
Expand Down Expand Up @@ -123,6 +130,10 @@ func (e *scenarioExecutor) notifyBeforeScenarioHook(scenarioResult *result.Scena
setScenarioFailure(e.currentExecutionInfo)
handleHookFailure(scenarioResult, res, result.AddPreHook)
}
if res.GetSkipScenario() {
scenarioResult.SetSkippedScenario()
scenarioResult.ProtoScenario.PreHookMessages = []string{res.ErrorMessage}
}
message.ScenarioExecutionStartingRequest.ScenarioResult = gauge.ConvertToProtoScenarioResult(scenarioResult)
e.pluginHandler.NotifyPlugins(message)
}
Expand Down Expand Up @@ -205,6 +216,11 @@ func (e *scenarioExecutor) executeSteps(steps []*gauge.Step, protoItems []*gauge
return false
}
}
if scenarioResult.GetSkippedScenario() {
// The step execution resulted in SkipScenario.
// The rest of steps execution is skipped
break;
}
}
}
return true
Expand All @@ -222,6 +238,9 @@ func (e *scenarioExecutor) executeStep(step *gauge.Step, protoItem *gauge_messag
se := &stepExecutor{runner: e.runner, pluginHandler: e.pluginHandler, currentExecutionInfo: e.currentExecutionInfo, stream: e.stream}
res := se.executeStep(step, protoItem.GetStep())
protoItem.GetStep().StepExecutionResult = res.ProtoStepExecResult()
if res.ProtoStepExecResult().ExecutionResult.GetSkipScenario() {
scenarioResult.SetSkippedScenario()
}
failed = res.GetFailed()
recoverable = res.ProtoStepExecResult().GetExecutionResult().GetRecoverableError()
}
Expand Down Expand Up @@ -262,6 +281,11 @@ func (e *scenarioExecutor) executeConcept(item *gauge.Step, protoConcept *gauge_

return cptResult
}
if scenarioResult.GetSkippedScenario() {
// The step execution resulted in SkipScenario.
// The rest of steps execution is skipped
break;
}
}
}
cptResult.UpdateConceptExecResult()
Expand Down Expand Up @@ -296,3 +320,15 @@ func setScenarioFailure(executionInfo *gauge_messages.ExecutionInfo) {
setSpecFailure(executionInfo)
executionInfo.CurrentScenario.IsFailed = true
}

func (e *scenarioExecutor) skippedScenarioUpdateErrMap(i gauge.Item, r result.Result) {
scenario := i.(*gauge.Scenario)
scenarioResult := r.(*result.ScenarioResult)
if len(scenarioResult.ProtoScenario.PreHookMessages) > 0 {
e.errMap.ScenarioErrs[scenario] = append([]error{errors.New(scenarioResult.ProtoScenario.PreHookMessages[0])}, e.errMap.ScenarioErrs[scenario]...)
scenarioResult.ProtoScenario.SkipErrors = scenarioResult.ProtoScenario.PreHookMessages
} else {
e.errMap.ScenarioErrs[scenario] = append([]error{errors.New(e.currentExecutionInfo.CurrentStep.ErrorMessage)}, e.errMap.ScenarioErrs[scenario]...)
scenarioResult.ProtoScenario.SkipErrors = []string{e.currentExecutionInfo.CurrentStep.ErrorMessage}
}
}
5 changes: 5 additions & 0 deletions execution/stepExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func (e *stepExecutor) executeStep(step *gauge.Step, protoStep *gauge_messages.P
e.currentExecutionInfo.CurrentStep.StackTrace = stepExecutionStatus.GetStackTrace()
setStepFailure(e.currentExecutionInfo)
stepResult.SetStepFailure()
} else if stepResult.GetSkippedScenario() {
e.currentExecutionInfo.CurrentStep.ErrorMessage = stepExecutionStatus.GetErrorMessage()
e.currentExecutionInfo.CurrentStep.StackTrace = stepExecutionStatus.GetStackTrace()
}
stepResult.SetProtoExecResult(stepExecutionStatus)
}
Expand Down Expand Up @@ -95,3 +98,5 @@ func (e *stepExecutor) notifyAfterStepHook(stepResult *result.StepResult) {
m.StepExecutionEndingRequest.StepResult = gauge.ConvertToProtoStepResult(stepResult)
e.pluginHandler.NotifyPlugins(m)
}


14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/daviddengcn/go-colortext v1.0.0
github.com/fsnotify/fsnotify v1.7.0
github.com/getgauge/common v0.0.0-20240331100109-225c78ec8f30
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240331094732-ac276d4db3b9
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240402072853-303b17b7c486
github.com/golang/protobuf v1.5.4
github.com/magiconair/properties v1.8.7
github.com/natefinch/lumberjack v2.0.0+incompatible
Expand All @@ -16,26 +16,26 @@ require (
github.com/schollz/closestmatch v2.1.0+incompatible
github.com/sourcegraph/go-langserver v2.0.0+incompatible
github.com/sourcegraph/jsonrpc2 v0.2.0
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.1
google.golang.org/protobuf v1.34.2
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/dmotylev/goproperties v0.0.0-20140630191356-7cbffbaada47 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
29 changes: 14 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/apoorvam/goterminal v0.0.0-20180523175556-614d345c47e5 h1:VYqcjykqpcq262cDxBAkAelSdg6HETkxgwzQRTS40Aw=
github.com/apoorvam/goterminal v0.0.0-20180523175556-614d345c47e5/go.mod h1:E7x8aDc3AQzDKjEoIZCt+XYheHk2OkP+p2UgeNjecH8=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand All @@ -14,8 +13,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/getgauge/common v0.0.0-20240331100109-225c78ec8f30 h1:pGrxY3IZb/1wwlSUSKYplmQ9kEh4rRpcAvQYI2WcxX0=
github.com/getgauge/common v0.0.0-20240331100109-225c78ec8f30/go.mod h1:q7UW1tDojJwCQPUHaE1ny71IZIDuKlsgh3Tyr5wAZDk=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240331094732-ac276d4db3b9 h1:g3Qhoj4ho3txgMcOJ3ivvEhfahaR6t8XTkf5K5M1VSA=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240331094732-ac276d4db3b9/go.mod h1:ZOT57PjvIqY31eGcwhj/LSi/K6ULBE1AhFcIMzWkmPg=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240402072853-303b17b7c486 h1:kb/Ey0fFX+EHPmFcOEZDa0s4bgsRpRF8iDJEcbZPgLU=
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20240402072853-303b17b7c486/go.mod h1:ZOT57PjvIqY31eGcwhj/LSi/K6ULBE1AhFcIMzWkmPg=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho=
Expand Down Expand Up @@ -56,23 +55,23 @@ github.com/sourcegraph/go-langserver v2.0.0+incompatible h1:lj2sRU7ZMIkW372IDVGb
github.com/sourcegraph/go-langserver v2.0.0+incompatible/go.mod h1:bBMjfpzEHd6ijPRoQ7f+knFfw+e8R+W158/MsqAy77c=
github.com/sourcegraph/jsonrpc2 v0.2.0 h1:KjN/dC4fP6aN9030MZCJs9WQbTOjWHhrtKVpzzSrr/U=
github.com/sourcegraph/jsonrpc2 v0.2.0/go.mod h1:ZafdZgk/axhT1cvZAPOhw+95nz2I/Ra5qMlU4gTRwIo=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down

0 comments on commit 9bd969b

Please sign in to comment.