@@ -72,8 +72,9 @@ func (r ReportResultSlice) Swap(i, j int) {
7272
7373type simpleTestCaseRunner struct {
7474 UnimplementedRunner
75- simpleResponse SimpleResponse
76- cookies []* http.Cookie
75+ simpleResponse SimpleResponse
76+ cookies []* http.Cookie
77+ apiSuggestLimit int
7778}
7879
7980// NewSimpleTestCaseRunner creates the instance of the simple test case runner
@@ -82,6 +83,7 @@ func NewSimpleTestCaseRunner() TestCaseRunner {
8283 UnimplementedRunner : NewDefaultUnimplementedRunner (),
8384 simpleResponse : SimpleResponse {},
8485 cookies : []* http.Cookie {},
86+ apiSuggestLimit : 10 ,
8587 }
8688 return runner
8789}
@@ -234,7 +236,6 @@ func (r *simpleTestCaseRunner) GetSuggestedAPIs(suite *testing.TestSuite, api st
234236
235237 var swagger * spec.Swagger
236238 if swagger , err = apispec .ParseURLToSwagger (suite .Spec .URL ); err == nil && swagger != nil {
237- result = []* testing.TestCase {}
238239 swaggerAPI := apispec .NewSwaggerAPI (swagger )
239240 for api , methods := range swaggerAPI .ApiMap {
240241 for _ , method := range methods {
@@ -267,6 +268,9 @@ func (r *simpleTestCaseRunner) GetSuggestedAPIs(suite *testing.TestSuite, api st
267268 testcase .Name = swagger .Paths .Paths [api ].Patch .ID
268269 }
269270 result = append (result , testcase )
271+ if len (result ) >= r .apiSuggestLimit {
272+ return
273+ }
270274 }
271275 }
272276 }
@@ -303,8 +307,9 @@ func (r *simpleTestCaseRunner) withResponseRecord(resp *http.Response) (response
303307func (r * simpleTestCaseRunner ) GetResponseRecord () SimpleResponse {
304308 return r .simpleResponse
305309}
306- func (s * simpleTestCaseRunner ) WithSuite (suite * testing.TestSuite ) {
307- // not need this parameter
310+
311+ func (r * simpleTestCaseRunner ) WithAPISuggestLimit (limit int ) {
312+ r .apiSuggestLimit = limit
308313}
309314
310315func expectInt (name string , expect , actual int ) (err error ) {
0 commit comments