-
Notifications
You must be signed in to change notification settings - Fork 0
/
testsuite_test.go
37 lines (34 loc) · 1.18 KB
/
testsuite_test.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
package main
import (
"fmt"
"io/ioutil"
"testing"
"gopkg.in/yaml.v2"
)
func TestTestSuiteReport(t *testing.T) {
scenarios := []string{"1","2","3"}
for _, filename := range scenarios {
yamlFile, _ := ioutil.ReadFile("scenarios/scenario" + filename + ".yml")
scenario := Scenario{}
yaml.Unmarshal(yamlFile, &scenario)
testSuite := newTestSuite()
for _, tc := range scenario.Calls {
testSuite.addTestCall(tc)
}
testCallReports := testSuite.buildReport()
if (len(testCallReports) == 0) {
t.Error("Empty TestCalls Reports found")
}
for second, tcr := range testCallReports {
if (
scenario.CallReports[second].N != tcr.N ||
scenario.CallReports[second].AverageTime != tcr.AverageTime ||
scenario.CallReports[second].MinimumTime != tcr.MinimumTime ||
scenario.CallReports[second].MaximumTime != tcr.MaximumTime ||
scenario.CallReports[second].AverageMemory != tcr.AverageMemory) {
t.Error("Bad TestCalls Report")
fmt.Println(tcr)
}
}
}
}