Skip to content

Commit 77c4d32

Browse files
sschulz92Sebastian Schulz
andauthored
Add timestamp in ISO-8601 format to JSON report output (#44)
Signed-off-by: sschulz92 <bastie92_spam@gmx.de> Co-authored-by: Sebastian Schulz <sebastian.schulz@reconiq.com>
1 parent b02413f commit 77c4d32

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

generate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type item interface {
3434
type suiteResult struct {
3535
ProjectName string `json:"projectName"`
3636
Timestamp string `json:"timestamp"`
37+
TimestampISO string `json:"timestampISO"`
3738
SuccessRate int `json:"successRate"`
3839
Environment string `json:"environment"`
3940
Tags string `json:"tags"`
@@ -56,6 +57,7 @@ type spec struct {
5657
SpecHeading string `json:"specHeading"`
5758
FileName string `json:"fileName"`
5859
Tags []string `json:"tags"`
60+
TimestampISO string `json:"timestampISO"`
5961
ExecutionTime int64 `json:"executionTime"`
6062
ExecutionStatus status `json:"executionStatus"`
6163
Scenarios []scenario `json:"scenarios"`
@@ -162,6 +164,7 @@ func toSuiteResult(psr *gauge_messages.ProtoSuiteResult) suiteResult {
162164
AfterSuiteHookMessages: make([]string, 0),
163165
SuccessRate: int(psr.GetSuccessRate()),
164166
Timestamp: psr.GetTimestamp(),
167+
TimestampISO: psr.GetTimestampISO(),
165168
ExecutionStatus: pass,
166169
}
167170
if psr.GetPreHookMessages() != nil {
@@ -193,6 +196,7 @@ func toSpec(psr *gauge_messages.ProtoSpecResult) spec {
193196
FailedScenarioCount: int(psr.GetScenarioFailedCount()),
194197
SkippedScenarioCount: int(psr.GetScenarioSkippedCount()),
195198
PassedScenarioCount: int(psr.GetScenarioCount() - psr.GetScenarioFailedCount() - psr.GetScenarioSkippedCount()),
199+
TimestampISO: psr.GetTimestampISO(),
196200
ExecutionTime: psr.GetExecutionTime(),
197201
ExecutionStatus: getStatus(psr.GetFailed(), psr.GetSkipped()),
198202
BeforeSpecHookFailure: toSpecHookFailure(psr.GetProtoSpec().GetPreHookFailures()),

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module github.com/getgauge-contrib/json-report
22

3-
go 1.24
3+
go 1.24.5
4+
5+
toolchain go1.24.6
46

57
require (
68
github.com/getgauge/common v0.0.0-20250512071011-6a075badb588
7-
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250701084704-a1ce52e639cd
9+
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250807074548-a830d747c72b
810
github.com/xeipuuv/gojsonschema v1.2.0
911
google.golang.org/grpc v1.74.2
1012
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ github.com/getgauge/common v0.0.0-20250512071011-6a075badb588 h1:2w5xN48+MY+CUtn
88
github.com/getgauge/common v0.0.0-20250512071011-6a075badb588/go.mod h1:j4ycvkEuUDSM1pYN2HAwjHtT70ErW3gB/tFKIP8znfE=
99
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250701084704-a1ce52e639cd h1:6vcBYHcGt1Nw3Acblub5FmUyNt9E5GlM1us2n6/Xfv0=
1010
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250701084704-a1ce52e639cd/go.mod h1:OMCZ/9zoRvl5mS1xJUgvFBM5MwbulLiHVxZ+Exls/f8=
11+
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250807074548-a830d747c72b h1:G9JXBz2oJeFiiTvZc6NSN3IJP5ML5rW7cKzeU7Ly0mw=
12+
github.com/getgauge/gauge-proto/go/gauge_messages v0.0.0-20250807074548-a830d747c72b/go.mod h1:5HXYsvuXOleQccz+zWMbu6QKQcmEJlwzlBTediyhWzQ=
1113
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
1214
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
1315
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "json-report",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"name": "JSON Report",
55
"description": "JSON reporting plugin",
66
"install": {

schema.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"description": "Timestamp of execution",
1212
"type": "string"
1313
},
14+
"timestampISO": {
15+
"description": "Timestamp of execution in ISO-8601 format",
16+
"type": "string"
17+
},
1418
"successRate": {
1519
"description": "Success rate of execution",
1620
"type": "integer"
@@ -489,4 +493,4 @@
489493
]
490494
}
491495
}
492-
}
496+
}

0 commit comments

Comments
 (0)