update unittests.

This commit is contained in:
徐聪
2022-01-19 20:51:00 +08:00
parent fb912fd7f8
commit 59ef894444
2 changed files with 13 additions and 19 deletions

View File

@@ -148,7 +148,7 @@ func (s *requestStats) collectReportData() map[string]interface{} {
"failed": s.transactionFailed, "failed": s.transactionFailed,
} }
data["stats"] = s.serializeStats() data["stats"] = s.serializeStats()
data["stats_total"] = s.total.getReport() data["stats_total"] = s.total.serialize()
data["errors"] = s.serializeErrors() data["errors"] = s.serializeErrors()
s.errors = make(map[string]*statsError) s.errors = make(map[string]*statsError)
return data return data
@@ -294,11 +294,6 @@ func (s *statsEntry) getStrippedReport() map[string]interface{} {
return report return report
} }
func (s *statsEntry) getReport() map[string]interface{} {
report := s.serialize()
return report
}
type statsError struct { type statsError struct {
name string name string
method string method string

View File

@@ -1,7 +1,6 @@
package scaffold package scaffold
import ( import (
"fmt"
"os" "os"
"os/exec" "os/exec"
"testing" "testing"
@@ -43,35 +42,35 @@ func TestGenDemoTestCase(t *testing.T) {
} }
} }
func Example_demo() { func TestExampleDemo(t *testing.T) {
buildHashicorpPlugin() buildHashicorpPlugin()
defer removeHashicorpPlugin() defer removeHashicorpPlugin()
demoTestCase.Config.ToStruct().Path = "../../examples/debugtalk.bin" demoTestCase.Config.ToStruct().Path = "../../examples/debugtalk.bin"
err := hrp.NewRunner(nil).Run(demoTestCase) // hrp.Run(demoTestCase) err := hrp.NewRunner(nil).Run(demoTestCase) // hrp.Run(demoTestCase)
fmt.Println(err) if err != nil {
// Output: t.Fail()
// <nil> }
} }
func Example_jsonDemo() { func TestJsonDemo(t *testing.T) {
buildHashicorpPlugin() buildHashicorpPlugin()
defer removeHashicorpPlugin() defer removeHashicorpPlugin()
testCase := &hrp.TestCasePath{Path: demoTestCaseJSONPath} testCase := &hrp.TestCasePath{Path: demoTestCaseJSONPath}
err := hrp.NewRunner(nil).Run(testCase) // hrp.Run(testCase) err := hrp.NewRunner(nil).Run(testCase) // hrp.Run(testCase)
fmt.Println(err) if err != nil {
// Output: t.Fail()
// <nil> }
} }
func Example_yamlDemo() { func TestYamlDemo(t *testing.T) {
buildHashicorpPlugin() buildHashicorpPlugin()
defer removeHashicorpPlugin() defer removeHashicorpPlugin()
testCase := &hrp.TestCasePath{Path: demoTestCaseYAMLPath} testCase := &hrp.TestCasePath{Path: demoTestCaseYAMLPath}
err := hrp.NewRunner(nil).Run(testCase) // hrp.Run(testCase) err := hrp.NewRunner(nil).Run(testCase) // hrp.Run(testCase)
fmt.Println(err) if err != nil {
// Output: t.Fail()
// <nil> }
} }