代码之家  ›  专栏  ›  技术社区  ›  Steve

Gatling-金牛座查询结果

  •  0
  • Steve  · 技术社区  · 6 年前

    execution:
    - executor: gatling
    concurrency: 1
    hold-for: 30s
    ramp-up: 3s
    scenario: Thread Group
    
    scenarios:
      Thread Group:
       requests:
        - label: demo
        method: GET
        url: https://Cname/health
        assert:
        - contains:
          - “healthy”
          subject: body
          regexp: true
          not: true
    

    所有的测试结果都是200分-耶!然而,当我用“someText”替换“health”时,它仍然返回200:(。我怀疑它没有执行assert条件,而只是验证是否存在端点。有什么见解值得赞赏吗?

    1 回复  |  直到 6 年前
        1
  •  0
  •   Steve    6 年前

    正确的答案是编写一个包含场景的单独脚本。这可以注入到代码中以查询响应,如下所示。

      val scn = scenario("check return details") 
        .exec(http("check the actual return ") 
          .get("urlLocation") 
             .check(jsonPath("$.friendlyName").is("testName")))