Skip to content

Commit

Permalink
Fixes an issue with missing scenario failure message (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
haroon-sheikh authored Jul 12, 2023
1 parent 54680ad commit 696ab03
Show file tree
Hide file tree
Showing 14 changed files with 8,359 additions and 4,908 deletions.
7 changes: 1 addition & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@ updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: google.golang.org/grpc
versions:
- 1.35.0
interval: weekly
8 changes: 4 additions & 4 deletions .github/workflows/release-on-pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Setup go 1.19
uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.19.0'
go-version-file: 'go.mod'

- name: build
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

steps:

- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Setup go 1.13.1
uses: actions/setup-go@v1
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.13.1
go-version-file: 'go.mod'

- name: Install pkg-config on ${{ matrix.os }}
if: matrix.os == 'macos-latest'
Expand Down
19 changes: 10 additions & 9 deletions builder/integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || darwin
// +build linux darwin

/*----------------------------------------------------------------
Expand Down Expand Up @@ -37,7 +38,7 @@ func init() {

func (s *MySuite) TestToVerifyXmlContent(c *C) {
value := gauge_messages.ProtoItem_Scenario
item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{Failed: false, ScenarioHeading: "Scenario1"}, ItemType: value}
item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{ScenarioHeading: "Scenario1"}, ItemType: value}
spec := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{item}}
specResult := &gauge_messages.ProtoSpecResult{ProtoSpec: spec, ScenarioCount: 1, Failed: false}
suiteResult := &gauge_messages.ProtoSuiteResult{SpecResults: []*gauge_messages.ProtoSpecResult{specResult}}
Expand Down Expand Up @@ -71,8 +72,8 @@ func (s *MySuite) TestToVerifyXmlContentForFailingExecutionResult(c *C) {
step := &gauge_messages.ProtoStep{StepExecutionResult: &gauge_messages.ProtoStepExecutionResult{ExecutionResult: result}}
steps := []*gauge_messages.ProtoItem{{Step: step, ItemType: stepType}}

item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{Failed: true,
ScenarioHeading: "Scenario1", ScenarioItems: steps}, ItemType: value}
item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{ScenarioHeading: "Scenario1",
ScenarioItems: steps, ExecutionStatus: gauge_messages.ExecutionStatus_FAILED}, ItemType: value}
spec := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{item}}
specResult := &gauge_messages.ProtoSpecResult{ProtoSpec: spec, ScenarioCount: 1, Failed: true, ScenarioFailedCount: 1}
suiteResult := &gauge_messages.ProtoSuiteResult{SpecResults: []*gauge_messages.ProtoSpecResult{specResult}}
Expand Down Expand Up @@ -114,8 +115,8 @@ func (s *MySuite) TestToVerifyXmlContentForMultipleFailuresInExecutionResult(c *
step2 := &gauge_messages.ProtoStep{StepExecutionResult: &gauge_messages.ProtoStepExecutionResult{ExecutionResult: result2}}
steps := []*gauge_messages.ProtoItem{{Step: step1, ItemType: stepType}, {Step: step2, ItemType: stepType}}

item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{Failed: true,
ScenarioHeading: "Scenario1", ScenarioItems: steps}, ItemType: value}
item := &gauge_messages.ProtoItem{Scenario: &gauge_messages.ProtoScenario{ScenarioHeading: "Scenario1",
ScenarioItems: steps, ExecutionStatus: gauge_messages.ExecutionStatus_FAILED}, ItemType: value}
spec := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{item}}
specResult := &gauge_messages.ProtoSpecResult{ProtoSpec: spec, ScenarioCount: 1, Failed: true, ScenarioFailedCount: 1}
suiteResult := &gauge_messages.ProtoSuiteResult{SpecResults: []*gauge_messages.ProtoSpecResult{specResult}}
Expand Down Expand Up @@ -156,7 +157,7 @@ func (s *MySuite) TestToVerifyXmlContentForMultipleFailuresWithNestedConcept(c *
cpt1 := &gauge_messages.ProtoItem{Concept: &gauge_messages.ProtoConcept{Steps: steps}, ItemType: cptType}
cpt2 := &gauge_messages.ProtoItem{Concept: &gauge_messages.ProtoConcept{Steps: append(steps, cpt1)}, ItemType: cptType}

scenario := &gauge_messages.ProtoScenario{Failed: true, ScenarioHeading: "Scenario1", ScenarioItems: append(steps, cpt2)}
scenario := &gauge_messages.ProtoScenario{ScenarioHeading: "Scenario1", ScenarioItems: append(steps, cpt2), ExecutionStatus: gauge_messages.ExecutionStatus_FAILED}
scenItem := &gauge_messages.ProtoItem{Scenario: scenario, ItemType: scenType}

spec := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{scenItem}}
Expand Down Expand Up @@ -228,8 +229,8 @@ func (s *MySuite) TestToVerifyXmlContentForFailingHookExecutionResult(c *C) {

func (s *MySuite) TestToVerifyXmlContentForDataTableDrivenExecution(c *C) {
value := gauge_messages.ProtoItem_TableDrivenScenario
scenario1 := gauge_messages.ProtoScenario{Failed: false, ScenarioHeading: "Scenario"}
scenario2 := gauge_messages.ProtoScenario{Failed: false, ScenarioHeading: "Scenario"}
scenario1 := gauge_messages.ProtoScenario{ScenarioHeading: "Scenario"}
scenario2 := gauge_messages.ProtoScenario{ScenarioHeading: "Scenario"}
item1 := &gauge_messages.ProtoItem{TableDrivenScenario: &gauge_messages.ProtoTableDrivenScenario{Scenario: &scenario1, TableRowIndex: 1}, ItemType: value}
item2 := &gauge_messages.ProtoItem{TableDrivenScenario: &gauge_messages.ProtoTableDrivenScenario{Scenario: &scenario2, TableRowIndex: 2}, ItemType: value}
spec1 := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{item1, item2}}
Expand Down Expand Up @@ -262,7 +263,7 @@ func (s *MySuite) TestToVerifyXmlContentForDataTableDrivenExecution(c *C) {

func (s *MySuite) TestToVerifyXmlContentForErroredSpec(c *C) {
value := gauge_messages.ProtoItem_TableDrivenScenario
scenario1 := gauge_messages.ProtoScenario{Failed: false, ScenarioHeading: "Scenario"}
scenario1 := gauge_messages.ProtoScenario{ScenarioHeading: "Scenario"}
item1 := &gauge_messages.ProtoItem{TableDrivenScenario: &gauge_messages.ProtoTableDrivenScenario{Scenario: &scenario1, TableRowIndex: 1}, ItemType: value}
spec1 := &gauge_messages.ProtoSpec{SpecHeading: "HEADING", FileName: "FILENAME", Items: []*gauge_messages.ProtoItem{item1}}
specResult := &gauge_messages.ProtoSpecResult{ProtoSpec: spec1, ScenarioCount: 1, Failed: true, Errors: []*gauge_messages.Error{{Type: gauge_messages.Error_PARSE_ERROR, Message: "message"}}}
Expand Down
4 changes: 2 additions & 2 deletions builder/xmlReportBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (x *XmlBuilder) getScenarioContent(result *gauge_messages.ProtoSpecResult,
Time: formatTime(int(scenario.GetExecutionTime())),
Failure: nil,
}
if scenario.GetFailed() {
if scenario.GetExecutionStatus() == gauge_messages.ExecutionStatus_FAILED {
var errors []string
failures := x.getFailure(scenario)
message := "Multiple failures"
Expand All @@ -186,7 +186,7 @@ func (x *XmlBuilder) getScenarioContent(result *gauge_messages.ProtoSpecResult,
Type: message,
Contents: strings.Join(errors, "\n\n"),
}
} else if scenario.GetSkipped() {
} else if scenario.GetExecutionStatus() == gauge_messages.ExecutionStatus_SKIPPED {
testCase.SkipMessage = &JUnitSkipMessage{
Message: strings.Join(scenario.SkipErrors, "\n"),
}
Expand Down
Loading

0 comments on commit 696ab03

Please sign in to comment.