github.com/getgauge/gauge@v1.6.9/execution/executionStatus.go (about) 1 package execution 2 3 import ( 4 "encoding/json" 5 6 "github.com/getgauge/gauge/logger" 7 ) 8 9 type executionStatus struct { 10 Type string `json:"type"` 11 SpecsExecuted int `json:"specsExecuted"` 12 SpecsPassed int `json:"specsPassed"` 13 SpecsFailed int `json:"specsFailed"` 14 SpecsSkipped int `json:"specsSkipped"` 15 SceExecuted int `json:"sceExecuted"` 16 ScePassed int `json:"scePassed"` 17 SceFailed int `json:"sceFailed"` 18 SceSkipped int `json:"sceSkipped"` 19 } 20 21 func (status *executionStatus) getJSON() (string, error) { 22 j, err := json.Marshal(status) 23 if err != nil { 24 return "", err 25 } 26 return string(j), nil 27 } 28 29 func statusJSON(executedSpecs, passedSpecs, failedSpecs, skippedSpecs, executedScenarios, passedScenarios, failedScenarios, skippedScenarios int) string { 30 executionStatus := &executionStatus{} 31 executionStatus.Type = "out" 32 executionStatus.SpecsExecuted = executedSpecs 33 executionStatus.SpecsPassed = passedSpecs 34 executionStatus.SpecsFailed = failedSpecs 35 executionStatus.SpecsSkipped = skippedSpecs 36 executionStatus.SceExecuted = executedScenarios 37 executionStatus.ScePassed = passedScenarios 38 executionStatus.SceFailed = failedScenarios 39 executionStatus.SceSkipped = skippedScenarios 40 s, err := executionStatus.getJSON() 41 if err != nil { 42 logger.Fatalf(true, "Unable to parse execution status information : %v", err.Error()) 43 } 44 return s 45 }