Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. {
  2. totalCount: 1134,
  3. limit: 9,
  4. offset: 0,
  5. resources: [
  6. {
  7. title: "Test",
  8. keyframeId: -1
  9. }
  10. {
  11. title: "Test1",
  12. keyframeId: 12345
  13. }
  14. {
  15. title: "Test2",
  16. keyframeId: 12341
  17. }
  18. {
  19. title: "Test3",
  20. keyframeId: -1
  21. }
  22. {
  23. title: "Test4",
  24. keyframeId: 135481
  25. }
  26. ....
  27. ....
  28. ]}
  29.  
  30. import scala.concurrent.duration._
  31. import io.gatling.core.Predef._
  32. import io.gatling.http.Predef._
  33. import io.gatling.jdbc.Predef._
  34.  
  35. class MamamSearch extends Simulation {
  36.  
  37. val testServerUrl = System.getProperty("testServerUrl", "https://someurl")
  38. val username = System.getProperty("username", "ma")
  39. val password = System.getProperty("password", "ma")
  40. val userCount = Integer.getInteger("userCount", 1).toInt
  41.  
  42. val httpProtocol = http
  43. .baseURL(testServerUrl)
  44. .inferHtmlResources(BlackList(""".*.js""", """.*.css""", """.*.gif""", """.*.jpeg""", """.*.jpg""", """.*.ico""", """.*.woff""", """.*.(t|o)tf""", """.*.png"""), WhiteList())
  45.  
  46. val headers_0 = Map(
  47. "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  48. "Cache-Control" -> "max-age=0",
  49. "Upgrade-Insecure-Requests" -> "1")
  50.  
  51. val headers_2 = Map("Accept" -> "text/css,*/*;q=0.1")
  52.  
  53. val headers_6 = Map(
  54. "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  55. "Accept-Encoding" -> "gzip, deflate, br",
  56. "Cache-Control" -> "max-age=0",
  57. "Origin" -> testServerUrl,
  58. "Upgrade-Insecure-Requests" -> "1")
  59.  
  60. val headers_80 = Map(
  61. "Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
  62. "Upgrade-Insecure-Requests" -> "1")
  63.  
  64. val headers_7 = Map("Accept" -> "image/webp,image/*,*/*;q=0.8")
  65.  
  66. val headers_11 = Map("Origin" -> testServerUrl)
  67.  
  68. val headers_12 = Map(
  69. "Cache-Control" -> "no-cache",
  70. "If-Modified-Since" -> "Mon, 26 Jul 1997 05:00:00 GMT",
  71. "Pragma" -> "no-cache",
  72. "X-Requested-With" -> "XMLHttpRequest")
  73.  
  74. val headers_15 = Map(
  75. "Accept" -> "application/json, text/plain, */*",
  76. "Cache-Control" -> "no-cache",
  77. "If-Modified-Since" -> "Mon, 26 Jul 1997 05:00:00 GMT",
  78. "Pragma" -> "no-cache",
  79. "X-Requested-With" -> "XMLHttpRequest")
  80.  
  81. val headers_16 = Map("Accept" -> "*/*")
  82.  
  83. val headers_18 = Map(
  84. "Accept" -> "text/html",
  85. "Cache-Control" -> "no-cache",
  86. "If-Modified-Since" -> "Mon, 26 Jul 1997 05:00:00 GMT",
  87. "Pragma" -> "no-cache",
  88. "X-Requested-With" -> "XMLHttpRequest")
  89.  
  90. val headers_19 = Map(
  91. "Accept" -> "*/*",
  92. "Accept-Encoding" -> "gzip, deflate, br",
  93. "Origin" -> testServerUrl)
  94.  
  95. val headers_27 = Map(
  96. "Accept" -> "*/*",
  97. "Accept-Encoding" -> "gzip, deflate, br",
  98. "Content-type" -> "text/plain",
  99. "Origin" -> testServerUrl)
  100.  
  101. val uri1 = testServerUrl + "/mamam"
  102. val uri2 = "https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0"
  103.  
  104. // Login request
  105. val scn = scenario("MamamSearch")
  106. .exec(http("Login")
  107. .post("/mamam/a/masteraccount/login")
  108. .headers(headers_6)
  109. .formParam("username", username)
  110. .formParam("password", password))
  111.  
  112.  
  113. // Fetch and save data
  114. .exec(http("Keyframe_request")
  115. .get(uri1 + "/awsset/browse%3Bresource_type=media%3Boffset=1%3Blimit=9")
  116. .headers(headers_12)
  117. .check(jsonPath("$.resources[*].keyframeId").findAll.saveAs("kList"))
  118. )
  119.  
  120. // added loop and conditions
  121. .doIf(session => session("Keyframe_request").validate[String].map(kList => !kList.contains("-1")))
  122. {
  123. foreach("${kList}", "keyId") {
  124. exec(http("Set_Keyframes")
  125. .get(uri1 + "/keyframes/${kList};width=185;height=103")
  126. .headers(headers_7))
  127. }
  128. }
  129.  
  130. .exec(http("Logout")
  131. .get("/mam/logout")
  132. .headers(headers_80))
  133.  
  134. setUp(scn.inject(atOnceUsers(userCount))).protocols(httpProtocol)
  135. }
  136.  
  137. 21345 [GatlingSystem-akka.actor.default-dispatcher-13] WARN i.g.http.ahc.AsyncHandlerActor - Request 'Set_Keyframes' failed: status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 400
  138. 21346 [GatlingSystem-akka.actor.default-dispatcher-13] DEBUG i.g.http.ahc.AsyncHandlerActor -
  139. >>>>>>>>>>>>>>>>>>>>>>>>>>
  140. Request:
  141. Set_Keyframes: KO status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 400
  142.  
  143. 21390 [GatlingSystem-akka.actor.default-dispatcher-4] INFO io.gatling.http.ahc.HttpEngine - Sending request=Set_Keyframes uri=https://someurl/mamam/keyframes/Vector(167154,%20167035,%20167037,%20167040,%20167029,%20167024,%20167026,%20167022,%20167023);width=185;height=103:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement