需要一个关于如何使用空手道脚本从头开始使用 gatling 进行性能测试的示例演示

Need one example deno on how to use karate scripts for peformance testing using gatling from scratch

我是性能测试的新手,我浏览了在加特林机中使用空手道脚本创建的示例项目,但无法理解如何去做,

谁能解释一下如何使用加特林机进行空手道性能测试,方法是使用一些 public api,如下所示

场景:获取州特定信息 - 一个州

给定 url 'http://services.groupkt.com/state/get/IND/AP' 当方法得到 然后状态200 * def resp = response.RestResponse.result.name * 打印响应

以便我们可以在我们的项目中使用它。无法理解 github 空手道

中可用的当前演示项目

您只需 Git-clone 和 运行(使用 Maven)这个简单的独立项目:https://github.com/ptrthomas/karate-gatling-demo

如果需要,请了解 Maven 项目的人的帮助。

一旦你得到这个 运行ning,你将能够立即理解和修改它。

package mock

import com.intuit.karate.gatling.PreDef._
import io.gatling.core.Predef._
import scala.concurrent.duration._

class CatsSimulation extends Simulation {

  val protocol = karateProtocol(
    "/cats/{id}" -> Nil,
    "/cats" -> Nil
  )

  val create = scenario("create").exec(karateFeature("classpath:mock/cats-create.feature"))
  val delete = scenario("delete").exec(karateFeature("classpath:mock/cats-delete.feature"))

  setUp(
    create.inject(rampUsers(10) over (5 seconds)).protocols(protocol),
    delete.inject(rampUsers(5) over (5 seconds)).protocols(protocol)
  )

}