-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datatypes.go
99 lines (86 loc) · 2.27 KB
/
datatypes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package cucumber
type Feature struct {
Elements []Scenario `json:"elements"`
Uri string `json:"uri"`
Id string `json:"id"`
Keyword string `json:"keyword"`
Name string `json:"name"`
Description string `json:"description"`
Linenumber int `json:"line"`
}
type Scenario struct {
Steps []Step `json:"steps"`
Tags []Tag `json:"tags"`
Id string `json:"id"`
Keyword string `json:"keyword"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
}
type Tag struct {
Name string `json:"name"`
Linenumber int `json:"line"`
}
type Step struct {
StepResult Stepresult `json:"result"`
match Filelocation `json:"match"`
Keyword string `json:"keyword"`
Name string `json:"name"`
Line int `json:"line"`
}
type Stepresult struct {
ErrorMsg string `json:"error_message"`
RunStatus string `json:"status"`
ExecutionTime int64 `json:"duration"`
}
type Filelocation struct {
Location string `json:"location"`
}
func GenerateScenario() Scenario {
return Scenario{}
}
func GenerateFeature(name string, id string, description string, line int) Feature {
return Feature{
Elements: nil,
Uri: name,
Id: id,
Keyword: "Feature",
Name: name,
Description: description,
Linenumber: line,
}
}
func (f *Feature) AddScenario(sc Scenario) {
f.Elements = append(f.Elements, sc)
}
func GenerateStep(keyword string, name string, line int, location string) Step {
newstep := Step{
StepResult: Stepresult{},
match: Filelocation{Location: location},
Keyword: keyword,
Name: name,
Line: line,
}
return newstep
}
func (sc *Scenario) AddStepObj(step Step) {
sc.Steps = append(sc.Steps, step)
}
func (sc *Scenario) AddStep(keyword string, name string, line int, location string, result string) {
newstep := Step{
StepResult: Stepresult{
RunStatus: result,
},
match: Filelocation{Location: location},
Keyword: keyword,
Name: name,
Line: line,
}
sc.Steps = append(sc.Steps, newstep)
}
func (s *Step) UpdateResult(status string, duration int64) {
s.StepResult = Stepresult{
RunStatus: status,
ExecutionTime: duration,
}
}