Skip to content

Only one testcase was generated for 1 API (possible issue with string constraints) #1203

Open
@ytfrank

Description

@ytfrank

Although running more than 1 million tests, only 1 testcase was generated for 1 restful API.

Here is the command, using the default config. Is there any problem? I remember that it used to be possible to
generate multiple testcases.

java -jar ~/Downloads/evomaster.jar  --maxTime 7200s --outputFolder "/Users/apple/gitrepo/EvoMaster/whitebox-demo/src/main/java/long9"
*
 _____          ___  ___          _
|  ___|         |  \/  |         | |
| |____   _____ | .  . | __ _ ___| |_ ___ _ __
|  __\ \ / / _ \| |\/| |/ _` / __| __/ _ \ '__|
| |___\ V / (_) | |  | | (_| \__ \ ||  __/ |
\____/ \_/ \___/\_|  |_/\__,_|___/\__\___|_|


* EvoMaster version: 3.4.0
* Loading configuration file from: /Users/apple/gitrepo/em.yaml
* Initializing...
00:28:14.270 [main] WARN  o.t.u.TestcontainersConfiguration - Attempted to read Testcontainers configuration file at file:/Users/apple/.testcontainers.properties but the file was not found. Exception message: FileNotFoundException: /Users/apple/.testcontainers.properties (No such file or directory)
* There is only 1 usable RESTful API endpoint defined in the schema configuration
* Starting to generate test cases
* Consumed search budget: 74.601%
* Consumed search budget: 99.994%
* Covered targets: 22; time per test: 4.0ms (1.0 actions); since last improvement: 4806s
* Starting to apply minimization phase
* Recomputing full coverage for 2 tests
02:28:15.179 [main] WARN  o.e.core.search.service.Minimizer - Different status code 500 returned from original null, ie, null != 500 for endpoint: POST:/api/bind_card_apply
* Recomputing coverage did lose many targets, more than the threshold 20.0%: from 22 to 7, i.e., lost 15
* Missing targets:
* Line_at_com.example.demo.controller.DemoController_00034
* Success_Call_at_com.example.demo.controller.DemoController_00034_0
* Success_Call_at_com.example.demo.controller.DemoController_00034_1
* Success_Call_at_com.example.demo.controller.DemoController_00034_2
* Success_Call_at_com.example.demo.controller.DemoController_00034_3
* Success_Call_at_com.example.demo.controller.DemoController_00034_4
* Success_Call_at_com.example.demo.controller.DemoController_00034_5
* Line_at_com.example.demo.controller.DemoController_00036
* Success_Call_at_com.example.demo.controller.DemoController_00036_0
* Line_at_com.example.demo.controller.DemoController_00037
* Line_at_com.example.demo.controller.DemoController_00038
* Success_Call_at_com.example.demo.controller.DemoController_00038_0
* Success_Call_at_com.example.demo.controller.DemoController_00038_1
* -1:POST:/api/bind_card_apply
* RESPONSE_BODY_PAYLOAD_POST/api/bind_card_apply_null
* No test to minimize
* Minimization phase took 0 seconds
* Evaluated tests: 1188138
* Evaluated actions: 1307316
* Needed budget: 34%
* Passed time (seconds): 7200
* Execution time per test (ms): Avg=4.77 , min=2.00 , max=35173.00
* Execution time per action (ms): Avg=4.42 , min=2.00 , max=35173.00
* Computation overhead between tests (ms): Avg=1.29 , min=0.00 , max=250.00
* Computation overhead of resetting the SUT (ms): Avg=0.99 , min=0.00 , max=28983.00
* Computation overhead of fetching test results, per test, subset of targets (ms): Avg=0.56 , min=0.00 , max=5131.00
* Going to save 1 test to /Users/apple/gitrepo/EvoMaster/whitebox-demo/src/main/java/long9
* TCP timeouts: 2
* Potential faults: 2
* Covered targets (lines, branches, faults, etc.): 10
* Bytecode line coverage: 2% (1 out of 42 in 1 units/classes)
* Successfully executed (HTTP code 2xx) 0 endpoints out of 1 (0%)
* EvoMaster process has completed successfully

And, below is the api doc:

openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
- url: http://localhost:8000
  description: Generated server url
paths:
  /api/bind_card_apply:
    post:
      tags:
      - demo-controller
      operationId: bindCardApply
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommonReqBindCardReq'
        required: true
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/CommonRespBindCardResp'
components:
  schemas:
    BindCardReq:
      required:
      - bankCardNo
      - bankCardPhoneNumber
      - idCardNo
      - loanPersonName
      type: object
      properties:
        idCardNo:
          maxLength: 18
          minLength: 18
          pattern: "^[0-9]{17}[0-9Xx]$"
          type: string
        loanPersonName:
          maxLength: 20
          minLength: 0
          type: string
        bankCardNo:
          maxLength: 19
          minLength: 16
          pattern: "^[0-9]+$"
          type: string
        bankCardPhoneNumber:
          maxLength: 11
          minLength: 11
          pattern: "^[1][3-9][0-9]{9}$"
          type: string
    CommonReqBindCardReq:
      type: object
      properties:
        appId:
          type: string
        data:
          type: string
        requestId:
          type: string
        timestamp:
          type: string
        key:
          type: string
        sign:
          type: string
        bizData:
          $ref: '#/components/schemas/BindCardReq'
    BindCardResp:
      type: object
      properties:
        code:
          type: string
        msg:
          type: string
        sessionId:
          type: string
    CommonRespBindCardResp:
      type: object
      properties:
        data:
          type: string
        key:
          type: string
        sign:
          type: string
        bizData:
          $ref: '#/components/schemas/BindCardResp'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions