我是Gatling的新手,并已在Ubuntu计算机上安装了3.1.3。 我有下面的代码来生成带有AUTH令牌的WS连接。但是,我猜想加特林某种程度上无法识别它,因为与python WSClient代码一起传递时,相同的令牌可以正常工作。
代码:
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class WebSockets extends Simulation {
val httpConf = http
.baseUrl("http://x.x.x.x:9080/v2.0/api/id/john/ws")
.acceptHeader("X-Auth-Token: c965d57a8bf285971e09bfb4a010710025dbe7a2-pa.u.exp=1563651221084&pa.p.id=password&t.id=john&pa.u.id=admin%40abc.com")
.wsBaseUrl("ws://x.x.x.x:9080/v2.0/api/id/john/ws")
val scn = scenario("LOAD TESTING")
.exec(ws("Connect WS").connect("ws://x.x.x.x:9080/v2.0/api/id/john/ws"))
.exec(ws("Close WS").close)
setUp(scn.inject(atOnceUsers(10))).protocols(httpConf)
}
日志:
Simulation WebSockets started...
================================================================================
2019-07-20 03:51:32 0s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=0 KO=10 )
> Connect WS (OK=0 KO=10 )
---- Errors --------------------------------------------------------------------
> i.n.h.c.h.w.WebSocketHandshakeException: Invalid handshake res 10 (50.00%)
ponse getStatus: 403 Forbidden
> Close WS: Client issued close order but WebSocket was already 10 (50.00%)
crashed: i.n.h.c.h.w.WebSocketHandshakeException: Invalid hand...
---- LOAD TESTING ------------------------------------------------------------
[##########################################################################]100%
waiting: 0 / active: 0 / done: 10
================================================================================
Simulation WebSockets completed in 0 seconds
Parsing log file(s)...
Parsing log file(s) done
Generating reports...
================================================================================
---- Global Information --------------------------------------------------------
> request count 10 (OK=0 KO=10 )
> min response time 117 (OK=- KO=117 )
> max response time 245 (OK=- KO=245 )
> mean response time 173 (OK=- KO=173 )
> std deviation 41 (OK=- KO=41 )
> response time 50th percentile 169 (OK=- KO=169 )
> response time 75th percentile 204 (OK=- KO=204 )
> response time 95th percentile 230 (OK=- KO=230 )
> response time 99th percentile 242 (OK=- KO=242 )
> mean requests/sec 10 (OK=- KO=10 )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms 0 ( 0%)
> 800 ms < t < 1200 ms 0 ( 0%)
> t > 1200 ms 0 ( 0%)
> failed 10 (100%)
---- Errors --------------------------------------------------------------------
> i.n.h.c.h.w.WebSocketHandshakeException: Invalid handshake res 10 (50.00%)
ponse getStatus: 403 Forbidden
> Close WS: Client issued close order but WebSocket was already 10 (50.00%)
crashed: i.n.h.c.h.w.WebSocketHandshakeException: Invalid hand...
================================================================================
Reports generated in 0s.
Please open the following file: /home/ubuntu/gatling-charts-highcharts-bundle-3.1.3/results/websockets-20190720075130408/index.html
期待一些帮助。
谢谢