change: print exit code

This commit is contained in:
lilong.129
2025-07-01 14:47:48 +08:00
parent 49005de709
commit a0c1315399
2 changed files with 5 additions and 5 deletions

View File

@@ -1 +1 @@
v5.0.0-250630 v5.0.0-250701

View File

@@ -36,9 +36,7 @@ import (
// Run starts to run testcase with default configs. // Run starts to run testcase with default configs.
func Run(t *testing.T, testcases ...ITestCase) error { func Run(t *testing.T, testcases ...ITestCase) error {
err := NewRunner(t).SetSaveTests(true).Run(testcases...) return NewRunner(t).SetSaveTests(true).Run(testcases...)
code.GetErrorCode(err)
return err
} }
// NewRunner constructs a new runner instance. // NewRunner constructs a new runner instance.
@@ -234,7 +232,9 @@ func (r *HRPRunner) Run(testcases ...ITestCase) (err error) {
// this ensures they run regardless of how the function exits // this ensures they run regardless of how the function exits
defer func() { defer func() {
s.Time.Duration = time.Since(s.Time.StartAt).Seconds() s.Time.Duration = time.Since(s.Time.StartAt).Seconds()
log.Info().Int("duration(s)", int(s.Time.Duration)).Msg("run testcase finished") exitCode := code.GetErrorCode(err)
log.Info().Int("duration(s)", int(s.Time.Duration)).
Int("exitCode", exitCode).Msg("run testcase finished")
// save summary // save summary
if r.saveTests { if r.saveTests {