我对性能测试非常陌生,我浏览了在加特林中使用空手道脚本创建的示例项目,但无法理解如何做到这一点,
任何人都可以解释如何使用空手道通过使用如下所示的公共 api 使用加特林进行性能测试
场景:获取州特定信息 - 一个州
给定网址'http://services.groupkt.com/state/get/IND/AP http://services.groupkt.com/state/get/IND/AP'
当方法得到
然后状态200
* def resp = response.RestResponse.result.name
* 打印响应
这样我们就可以在我们的项目中使用它。无法理解 github karate 中当前可用的演示项目
您只需 Git 克隆并运行(使用 Maven)这个简单的独立项目:https://github.com/ptrthomas/karate-gadling-demo 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)
)
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)