feat: add hrp.Run wrapper

This commit is contained in:
lilong.129
2023-06-06 20:38:43 +08:00
parent b3a832fdf0
commit f3e5f3ac85
14 changed files with 31 additions and 44 deletions
+5 -9
View File
@@ -30,10 +30,11 @@ import (
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
)
// Run starts to run API test with default configs.
func Run(testcases ...ITestCase) error {
t := &testing.T{}
return NewRunner(t).SetRequestsLogOn().Run(testcases...)
// Run starts to run testcase with default configs.
func Run(t *testing.T, testcases ...ITestCase) error {
err := NewRunner(t).SetSaveTests(true).Run(testcases...)
code.GetErrorCode(err)
return err
}
// NewRunner constructs a new runner instance.
@@ -204,11 +205,6 @@ func (r *HRPRunner) Run(testcases ...ITestCase) (err error) {
// record execution data to summary
s := newOutSummary()
defer func() {
exitCode := code.GetErrorCode(err)
log.Info().Int("code", exitCode).Msg("hrp runner exit code")
}()
// load all testcases
testCases, err := LoadTestCases(testcases...)
if err != nil {