feat: record execution data for report #25

This commit is contained in:
xucong053
2022-01-26 13:38:18 +08:00
parent 92f7430634
commit 56cc99bbc0
13 changed files with 337 additions and 124 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/httprunner/hrp"
"github.com/httprunner/hrp/internal/builtin"
)
var (
@@ -32,11 +33,11 @@ func removeHashicorpPlugin() {
func TestGenDemoTestCase(t *testing.T) {
tCase, _ := demoTestCase.ToTCase()
err := tCase.Dump2JSON(demoTestCaseJSONPath)
err := builtin.Dump2JSON(tCase, demoTestCaseJSONPath)
if err != nil {
t.Fail()
}
err = tCase.Dump2YAML(demoTestCaseYAMLPath)
err = builtin.Dump2YAML(tCase, demoTestCaseYAMLPath)
if err != nil {
t.Fail()
}

View File

@@ -8,6 +8,7 @@ import (
"path"
"strings"
"github.com/httprunner/hrp/internal/builtin"
"github.com/httprunner/hrp/internal/ga"
"github.com/rs/zerolog/log"
)
@@ -48,12 +49,12 @@ func CreateScaffold(projectName string) error {
// create demo testcases
tCase, _ := demoTestCase.ToTCase()
err := tCase.Dump2JSON(path.Join(projectName, "testcases", "demo.json"))
err := builtin.Dump2JSON(tCase, path.Join(projectName, "testcases", "demo.json"))
if err != nil {
log.Error().Err(err).Msg("create demo.json testcase failed")
return err
}
err = tCase.Dump2YAML(path.Join(projectName, "testcases", "demo.yaml"))
err = builtin.Dump2YAML(tCase, path.Join(projectName, "testcases", "demo.yaml"))
if err != nil {
log.Error().Err(err).Msg("create demo.yml testcase failed")
return err