我的加特林模拟课,
class <MyClass> extends Simulation {
before {
println("Simulation is about to start!")
}
val smapleTest = scenario("test").exec(karateFeature("classpath:demo/get-user.feature"))
setUp(
smapleTest.inject(rampUsers(1) over (10 seconds))).maxDuration(1 minutes)
//).assertions(global.responseTime.mean.lt(35))
after {
println("Simulation is finished!")
}
}
我的get-user.feature文件,
Scenario Outline: Hit wskadmin url
Given http://172.17.0.1:5984/whisk_local_subjects/guest
And header Authorization = AdminAuth
And header Content-Type = 'application/json'
When method get
Then status <stat>
* print result
Examples:
| stat |
| 200 |
当我运行模拟类时,在控制台日志下面,我得到:
Simulation com.karate.openwhisk.performance.SmokePerformanceTest started...
13:20:48.877 [GatlingSystem-akka.actor.default-dispatcher-5] INFO i.gatling.core.controller.Controller - InjectionStopped expectedCount=1
13:20:49.473 [GatlingSystem-akka.actor.default-dispatcher-4] INFO com.intuit.karate - karate.env system property was: null
13:20:49.525 [GatlingSystem-akka.actor.default-dispatcher-7] INFO com.intuit.karate - [print] I am here in get-user
13:20:49.706 [GatlingSystem-akka.actor.default-dispatcher-4] DEBUG com.intuit.karate - request:
1 > GET http://172.17.0.1:5984/whisk_local_subjects/guest
1 > Accept-Encoding: gzip,deflate
1 > Authorization: Basic d2hpc2tfYWRtaW46c29tZV9wYXNzdzByZA==
1 > Connection: Keep-Alive
1 > Content-Type: application/json
1 > Host: 172.17.0.1:5984
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_144)
13:20:49.741 [GatlingSystem-akka.actor.default-dispatcher-4] DEBUG com.intuit.karate - response time in milliseconds: 34
1 < 200
注意:在这里,我会在34毫秒内得到答复,但门控无法生成报告。以下是我收到的错误消息
错误:
Generating reports... java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50) at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33) Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:48) at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:76) at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:55) at io.gatling.app.Gatling$.start(Gatling.scala:68) at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45) at io.gatling.app.Gatling$.main(Gatling.scala:37) at io.gatling.app.Gatling.main(Gatling.scala) ... 6 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.199 s [INFO] Finished at: 2018-07-24T13:20:50+05:30 [INFO] Final Memory: 30M/332M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.gatling:gatling-maven-plugin:2.2.4:test (default-cli) on project
openwhisk:加特林失败。:进程退出,错误:255(退出 值:255)-> [帮助1]
但是如果我运行相同的仿真文件,则对功能文件进行如下简单更改
Scenario Outline: Hit wskadmin url
Given http://172.17.0.1:5984/whisk_local_subjects/guest
And header Authorization = AdminAuth
And header Content-Type = 'application/json'
When method get
Then status <stat>
* print result
Examples:
| stat |
| 200 |
| 200 |
然后加特林特生成报告。 请帮助我某人的根本原因。