首页 文章

需要一个例子来说明如何使用空手道脚本进行性能测试,从头开始使用gatling

提问于
浏览
-1

我是非常新的测试,我经历了使用空手道脚本创建的示例项目,但无法理解如何做到,

任何人都可以通过使用下面的一些公共api来解释如何使用空手道进行性能测试

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

给定网址'http://services.groupkt.com/state/get/IND/AP'当方法获得时,状态200 * def resp = response.RestResponse.result.name * print resp

这样我们就可以在项目中使用它了 . 无法理解github karate中当前可用的演示项目

1 回答

  • 0

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

    如果需要,请在熟悉Maven项目的人的帮助下 .

    一旦运行,您将能够立即理解和修改它 .

    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)
      )
    
    }
    

相关问题