mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
fix: return error when testcase count less than 1
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v4.3.7.2311301111
|
v4.3.7
|
||||||
@@ -53,6 +53,7 @@ func LoadTestCases(iTestCases ...ITestCase) ([]*TestCase, error) {
|
|||||||
testCasePath := TestCasePath(path)
|
testCasePath := TestCasePath(path)
|
||||||
tc, err := testCasePath.ToTestCase()
|
tc, err := testCasePath.ToTestCase()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error().Err(err).Msg("fail to parse test:")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
testCases = append(testCases, tc)
|
testCases = append(testCases, tc)
|
||||||
@@ -63,6 +64,10 @@ func LoadTestCases(iTestCases ...ITestCase) ([]*TestCase, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(testCases) < 1 {
|
||||||
|
return nil, errors.New("test case count less than 1 or parse error")
|
||||||
|
}
|
||||||
|
|
||||||
log.Info().Int("count", len(testCases)).Msg("load testcases successfully")
|
log.Info().Int("count", len(testCases)).Msg("load testcases successfully")
|
||||||
return testCases, nil
|
return testCases, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user