Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ JSON reporting plugin for [Gauge](http://gauge.org)
Installation
------------

### Install through Gauge
### Install through Gauge

```
gauge install json-report
```

Installing specific version:

```
gauge install json-report --version 0.1.0
```

### Offline installation

* Download the plugin from [Releases](https://github.com/getgauge-contrib/json-report/releases)

```
gauge install json-report --file <path_to_plugin_zip_file>
```
Expand Down Expand Up @@ -51,6 +54,7 @@ Build from Source
-----------------

### Requirements

* [Golang](http://golang.org/)

### Compiling
Expand All @@ -66,6 +70,7 @@ go run build/make.go --all-platforms
```

### Installing

After compilation

```
Expand Down Expand Up @@ -95,15 +100,15 @@ go run build/make.go --distro --all-platforms
Contributing
------------

- Identify/pick an issue
- raise a pull request
- one of the maintainers should review and merge.
* Identify/pick an issue
* raise a pull request
* one of the maintainers should review and merge.

### Release

Github Actions have been setup for test/deploy of this project. Tests will run for all pull requests, however to make a release, a `deployment` has to be triggered.

To do a release:

- [Create a github Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
- Set `GITHUB_TOKEN` env var to the above value, and invoke [`./release.sh`](release.sh)
* [Create a github Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
* Set `GITHUB_TOKEN` env var to the above value, and invoke [`./release.sh`](release.sh)
6 changes: 4 additions & 2 deletions _testdata/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"afterScenarioHookFailure": null,
"afterScenarioHookMessages": [],
"skipErrors": [],
"tableRowIndex": -1
"tableRowIndex": -1,
"retriesCount": 0
},
{
"scenarioHeading": "Vowel counts in multiple word",
Expand Down Expand Up @@ -236,7 +237,8 @@
"afterScenarioHookFailure": null,
"afterScenarioHookMessages": [],
"skipErrors": [],
"tableRowIndex": -1
"tableRowIndex": -1,
"retriesCount": 0
}
],
"isTableDriven": false,
Expand Down
2 changes: 2 additions & 0 deletions generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type scenario struct {
AfterScenarioHookMessages []string `json:"afterScenarioHookMessages"`
SkipErrors []string `json:"skipErrors"`
TableRowIndex int `json:"tableRowIndex"`
RetriesCount int64 `json:"retriesCount"`
}

type step struct {
Expand Down Expand Up @@ -242,6 +243,7 @@ func toScenario(protoSce *gauge_messages.ProtoScenario, tableRowIndex int) scena
AfterScenarioHookMessages: make([]string, 0),
TableRowIndex: tableRowIndex,
SkipErrors: make([]string, 0),
RetriesCount: protoSce.GetRetriesCount(),
}
if protoSce.GetPreHookMessages() != nil {
sce.BeforeScenarioHookMessages = protoSce.GetPreHookMessages()
Expand Down
17 changes: 17 additions & 0 deletions generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package main

import (
"fmt"
"testing"

"path/filepath"

"github.com/getgauge/gauge-proto/go/gauge_messages"
"github.com/xeipuuv/gojsonschema"
. "gopkg.in/check.v1"
)
Expand All @@ -23,3 +25,18 @@ func (s *MySuite) TestJSONReportWithSchema(c *C) {
}
c.Assert(result.Valid(), Equals, true)
}

func TestToScenario_SetsRetriesCount(t *testing.T) {
expectedRetries := int64(3)
protoSce := &gauge_messages.ProtoScenario{
// Set the retries count
RetriesCount: expectedRetries,
}

tableRowIndex := 0
sc := toScenario(protoSce, tableRowIndex)

if sc.RetriesCount != expectedRetries {
t.Errorf("Expected RetriesCount to be %d, but got %d", expectedRetries, sc.RetriesCount)
}
}
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "json-report",
"version": "0.5.2",
"version": "0.5.3",
"name": "JSON Report",
"description": "JSON reporting plugin",
"install": {
Expand Down
7 changes: 6 additions & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
"tableRowIndex": {
"description": "Table row index, if its a table driven execution",
"type": "integer"
},
"retriesCount": {
"description": "Number of retries to execute the scenario",
"type": "integer"
}
},
"required": [
Expand All @@ -234,7 +238,8 @@
"afterScenarioHookFailure",
"afterScenarioHookMessages",
"skipErrors",
"tableRowIndex"
"tableRowIndex",
"retriesCount"
]
}
},
Expand Down
Loading