fix: return error when testcase count less than 1

This commit is contained in:
huangbin.beal@163.com
2024-02-27 15:58:07 +08:00
parent e5bf385aa9
commit 3a77578c5d
2 changed files with 6 additions and 1 deletions

View File

@@ -1 +1 @@
v4.3.7.2311301111
v4.3.7

View File

@@ -53,6 +53,7 @@ func LoadTestCases(iTestCases ...ITestCase) ([]*TestCase, error) {
testCasePath := TestCasePath(path)
tc, err := testCasePath.ToTestCase()
if err != nil {
log.Error().Err(err).Msg("fail to parse test:")
return nil
}
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")
return testCases, nil
}