{"id":322203,"date":"2021-04-27T15:01:09","date_gmt":"2021-04-27T15:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322203"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322203","title":{"rendered":"\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 Gatling \u2014 \u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e (\u0427\u0430\u0441\u0442\u044c 2)"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/dS3d\/\"><strong>\u00ab\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb.<\/strong><\/a> <\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e7\/ff4\/431\/8e7ff44315fdf4a5945bc56bb7b6937e.png\" width=\"780\" height=\"439\"><figcaption><\/figcaption><\/figure>\n<hr>\n<h2>4. \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u2014 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/h2>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/552846\/\">\u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/a> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/a> (Video Game Database). \u042d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439, \u043a\u0430\u043a \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0432\u044b\u0434\u0443\u043c\u0430\u043d\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440. \u041e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c API, \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/swagger.io\/\">Swagger,<\/a> \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 HTTP-\u043a\u043e\u043c\u0430\u043d\u0434\u044b (Get, Put, Update, Delete) \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 XML \u0438 JSON \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u044b.<\/p>\n<p>\u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 (\u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435) <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> \u0438 \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u0432\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0435\u0433\u043e \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041e\u0442\u0442\u0443\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e:<\/p>\n<ul>\n<li>\n<p><strong>Gradle<\/strong> \u2014 <code>.\/gradlew bootRun<\/code><\/p>\n<\/li>\n<li>\n<p><strong>Maven<\/strong> \u2014 <code>mvn spring-boot:run<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043d\u0435\u043c\u0443 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443: <a href=\"http:\/\/localhost:8080\/swagger-ui\/index.html#\/\">http:\/\/localhost:8080\/swagger-ui\/index.html#\/<\/a><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 Swagger \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/240\/89c\/5d4\/24089c5d4f86e1f9af5489f5ee6496b5.png\" alt=\"Video Game Database\" title=\"Video Game Database\" width=\"650\" height=\"367\"><figcaption>Video Game Database<\/figcaption><\/figure>\n<p>\u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0432\u0430\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u044b\u043a\u0430\u0442\u044c API \u0447\u0435\u0440\u0435\u0437 Swagger, \u043f\u0440\u043e\u0431\u0443\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0441 XML \u0438 JSON.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 (\u0438\u043b\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435) \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e <\/em><a href=\"http:\/\/video-game-db.eu-west-2.elasticbeanstalk.com\/swagger-ui\/index.html\"><em>\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440 \u043d\u0430 AWS<\/em><\/a><em>. \u041f\u0440\u0438\u0447\u0438\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439, \u0443 \u043a\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e\u0442 AWS \u0430\u0434\u0440\u0435\u0441, \u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435!<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling.<\/p>\n<hr>\n<h2>5. \u041e\u0441\u043d\u043e\u0432\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling<\/h2>\n<p>\u0412 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Gatling \u0441 \u0446\u0435\u043b\u044c\u044e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 <em>\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439<\/em> \u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e <strong>\u043f\u0430\u043a\u0435\u0442\u0430<\/strong> \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043f\u043a\u0438 <em>scala<\/em> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448\u0438 Gatling \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u041d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 simulations.<\/p>\n<h3>5.1 \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430&nbsp; Gatling<\/h3>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Scala<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>MyFirstTest<\/code>. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  class MyFirstTest extends Simulation {    &nbsp;&nbsp;\/\/ 1 Http Conf (\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Http)&nbsp; &nbsp;&nbsp;val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\") &nbsp;&nbsp;&nbsp;&nbsp;.header(\"Accept\", \"application\/json\") &nbsp;&nbsp;&nbsp;&nbsp;.proxy(Proxy(\"localhost\", 8888))    &nbsp;&nbsp;\/\/ 2 Scenario Definition (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f) &nbsp;&nbsp;val scn = scenario(\"My First Test\") &nbsp;&nbsp;&nbsp;&nbsp;.exec(http(\"Get All Games\") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.get(\"videogames\"))    &nbsp;&nbsp;\/\/ 3 Load Scenario (\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438) &nbsp;&nbsp;setUp( &nbsp;&nbsp;&nbsp;&nbsp;scn.inject(atOnceUsers(1)) &nbsp;&nbsp;).protocols(httpConf) }<\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 Gatling, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:8080\/app\/videogames\">http:\/\/localhost:8080\/app\/videogames<\/a>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<h4>5.1.1 \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p>\u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0434\u0432\u0430 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre><code class=\"scala\">import io.gatling.core.Predef._ import io.gatling.http.Predef._<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u043a\u0435\u0442\u044b Gatling &#8212; \u043e\u043d\u0438 <em>\u043e\u0431\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling<\/em>.<\/p>\n<h4>5.1.2 Extends Simulation<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 <code>Scala<\/code> \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 <code>Gatling Simulation<\/code>:<\/p>\n<pre><code class=\"scala\">class MyFirstTest extends Simulation {<\/code><\/pre>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 Gatling, \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Simulation \u043f\u0430\u043a\u0435\u0442\u0430 Gatling.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 3 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438:<\/p>\n<h4>5.1.3 \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP (Http Conf)<\/h4>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c <strong>\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e HTTP<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Gatling.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"scala\">\/\/ 1 Http Conf val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\") &nbsp;&nbsp;&nbsp;&nbsp;.header(\"Accept\", \"application\/json\")<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c <code>baseUrl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 API \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435.<\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (header), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435, <strong>Accept -&gt; application\/json<\/strong>.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 <a href=\"https:\/\/gatling.io\/docs\/current\/http\/http_protocol\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Gatling \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP<\/a>.<\/p>\n<h4>5.1.4 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f (Scenario Definition)<\/h4>\n<p>\u0421\u0435\u043a\u0446\u0438\u044f<strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f <\/strong>\u044d\u0442\u043e \u0442\u043e \u043c\u0435\u0441\u0442\u043e<strong> <\/strong>\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 Gatling, \u0433\u0434\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0448 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c (user journey). \u042d\u0442\u043e \u0448\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c 5 \u0441\u0435\u043a\u0443\u043d\u0434<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u044b<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0438 \u0442. \u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e GET \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 videogames. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u0430\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 <a href=\"http:\/\/localhost:8080\/app\/videogames\">http:\/\/localhost:8080\/app\/videogames<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 <strong>baseUrl<\/strong> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP \u0432\u044b\u0448\u0435:<\/p>\n<pre><code class=\"scala\">\/\/ 2 Scenario Definition (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f) val scn = scenario(\"My First Test\")         &nbsp; .exec(http(\"Get All Games\") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        .get(\"videogames\"))<\/code><\/pre>\n<h4>5.1.5 &#8212; \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h4>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Gatling \u2014 \u044d\u0442\u043e <strong>\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/strong>. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0430\u043a \u0434\u043e\u043b\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0442. \u0434.) \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0430 Gatling. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u043e <em>\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0435\u0439<\/em><\/p>\n<pre><code class=\"scala\">\/\/ 3 Load Scenario (\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438) setUp( &nbsp;&nbsp;&nbsp;scn.inject(atOnceUsers(1)) &nbsp;&nbsp;&nbsp;).protocols(httpConf)<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0443 \u043d\u0430\u0441 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 Gatling! \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043b\u0430\u0441\u0441 <code>Engine<\/code> \u0438 \u0432\u044b\u0431\u0440\u0430\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 <code>MyFirstTest<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/39a\/439\/de2\/39a439de22eeced190c4a6690f76ccab.png\" alt=\"My First Gatling Test\" title=\"My First Gatling Test\" width=\"650\" height=\"582\"><figcaption>My First Gatling Test<\/figcaption><\/figure>\n<p>\u042d\u0442\u0438 3 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Gatling:<\/p>\n<h3>5.2 \u041f\u0430\u0443\u0437\u0430 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0434\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0443\u0437\u044b (pause) \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 HTTP.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Scala \u0432 \u043f\u0430\u043f\u043a\u0435 <em>simulations<\/em> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>CheckResponseCode<\/code>. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  import scala.concurrent.duration.DurationInt  class CheckResponseCode extends Simulation {    val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\")     .header(\"Accept\", \"application\/json\")    val scn = scenario(\"Video Game DB - 3 calls\")      .exec(http(\"Get all video games - 1st call\")       .get(\"videogames\")       .check(status.is(200)))     .pause(5)      .exec(http(\"Get specific game\")       .get(\"videogames\/1\")       .check(status.in(200 to 210)))     .pause(1, 20)      .exec(http(\"Get all Video games - 2nd call\")       .get(\"videogames\")       .check(status.not(404), status.not(500)))     .pause(3000.milliseconds)    setUp(     scn.inject(atOnceUsers(1))   ).protocols(httpConf)  }<\/code><\/pre>\n<h4>5.2.1 \u041f\u0430\u0443\u0437\u044b<\/h4>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c 3 \u0432\u044b\u0437\u043e\u0432\u0430 API. \u041e\u0434\u0438\u043d \u043a <strong>videogames<\/strong>, \u0437\u0430\u0442\u0435\u043c \u043e\u0434\u0438\u043d \u043a <strong>videogames\/1<\/strong>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043a <strong>videogames<\/strong>.<\/p>\n<p>\u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u0443\u0437\u044b \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>18<\/strong> \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>.pause(5)<\/code> &#8212; \u044d\u0442\u043e \u043f\u0430\u0443\u0437\u0430 \u043d\u0430 5 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>24<\/strong> \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 <code>.pause(1, 20)<\/code> &#8212; \u044d\u0442\u043e \u043f\u0430\u0443\u0437\u0430 \u043d\u0430 <em>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435<\/em> \u0432\u0440\u0435\u043c\u044f \u043e\u0442 1 \u0434\u043e 20 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>29<\/strong> \u0443 \u043d\u0430\u0441 <code>.pause(3000.milliseconds)<\/code> &#8212; \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e \u0441\u043a\u0440\u0438\u043f\u0442 Gatling \u043d\u0430 3000 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0427\u0442\u043e\u0431\u044b Gatling \u043c\u043e\u0433 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c <strong>milliseconds<\/strong>, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>scala.concurrent.duration.DurationInt<\/code> \u0432 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<h4>5.2.2 \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0434\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430<\/h4>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 API Gatling \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0441\u0441\u0435\u0440\u0442\u0443, Gatling \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>17 <\/strong>\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 <code>.check(status.is(200)))<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 &#8212; 200.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>23<\/strong> \u0443 \u043d\u0430\u0441 <code>.check(status.in(200 to 210)))<\/code>, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 200 \u0434\u043e 210.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>28<\/strong> \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u041d\u0415 \u0431\u044b\u043b \u0447\u0435\u043c-\u0442\u043e \u0438\u0437 <code>.check(status.not(404, status.not(500)))<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 404 \u0438\u043b\u0438 500.<\/p>\n<h3>5.3 \u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0432 Gatling \u0441 Check API<\/h3>\n<p>Check API \u0432 Gatling \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0432\u0435\u0449\u0435\u0439:<\/p>\n<ul>\n<li>\n<p>\u0410\u0441\u0441\u0435\u0440\u0442\u0430, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/jsonpath.com\/\">JSONPath<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c JSONPath \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 <em>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439<\/em>. \u0410 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u044d\u0442\u0443<\/strong> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0435 API.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0435\u0439 (correlation) <\/strong>\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 <em>simulations <\/em>\u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>CheckResponseBodyAndExtract<\/code>. \u0412\u043e\u0442 \u0435\u0433\u043e \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  class CheckResponseBodyAndExtract extends Simulation {    val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\")     .header(\"Accept\", \"application\/json\")    val scn = scenario(\"Check JSON Path\")        \/\/ First call - check the name of the game       .exec(http(\"Get specific game\")       .get(\"videogames\/1\")       .check(jsonPath(\"$.name\").is(\"Resident Evil 4\")))        \/\/ Second call - extract the ID of a game and save it to a variable called gameId       .exec(http(\"Get all video games\")       .get(\"videogames\")       .check(jsonPath(\"$[1].id\").saveAs(\"gameId\")))        \/\/ Third call - use the gameId variable saved from the above call       .exec(http(\"Get specific game\")       .get(\"videogames\/${gameId}\")       .check(jsonPath(\"$.name\").is(\"Gran Turismo 3\"))    setUp(     scn.inject(atOnceUsers(1))   ).protocols(httpConf)  }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c 3 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 API. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c JSONPath, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 <strong>name<\/strong> \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c JSON \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 <em>Resident Evil 4<\/em> :<\/p>\n<pre><code class=\"scala\">  .exec(http(\"Get specific game\")   .get(\"videogames\/1\")   .check(jsonPath(\"$.name\").is(\"Resident Evil 4\")))<\/code><\/pre>\n<p>\u0412\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0438 \u0430\u0441\u0441\u0435\u0440\u0442\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438\u0433\u0440\u044b. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u044b \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041c\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c <strong>id<\/strong> \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0433\u0440\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0439 \u0432 JSON (\u0442.\u0435. \u0438\u0433\u0440\u0443 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 1):<\/p>\n<pre><code class=\"scala\">  .exec(http(\"Get all video games\")   .get(\"videogames\")   .check(jsonPath(\"$[1].id\").saveAs(\"gameId\")))<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>gameId<\/code>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 URL-\u0430\u0434\u0440\u0435\u0441\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 API:<\/p>\n<pre><code class=\"scala\">  .exec(http(\"Get specific game\")   .get(\"videogames\/${gameId}\")   .check(jsonPath(\"$.name\").is(\"Gran Turismo 3\"))<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044e \u0432 Gatling, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>.check()<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>.saveAs<\/code><\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e <a href=\"https:\/\/gatling.io\/docs\/current\/http\/http_check\">Check API \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Gatling.<\/a><\/p>\n<h3>5.4. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 Gatling \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/h3>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440, \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e HTTP-\u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d HTTP-\u0432\u044b\u0437\u043e\u0432 \u0442\u043e\u0439 \u0436\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438, \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u044d\u0442\u0430\u043f\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043b\u043e\u0433\u0438\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 <em>simulations<\/em> \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c <code>CodeReuseWithObjects<\/code>. \u0412\u043e\u0442 \u0435\u0433\u043e \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  class CodeReuseWithObjects extends Simulation {    val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\")     .header(\"Accept\", \"application\/json\")     def getAllVideoGames() = {     repeat(3) {       exec(http(\"Get all video games - 1st call\")         .get(\"videogames\")         .check(status.is(200)))     }   }    def getSpecificVideoGame() = {     repeat(5) {       exec(http(\"Get specific game\")         .get(\"videogames\/1\")         .check(status.in(200 to 210)))     }   }    val scn = scenario(\"Code reuse\")       .exec(getAllVideoGames())       .pause(5)       .exec(getSpecificVideoGame())       .pause(5)       .exec(getAllVideoGames())    setUp(     scn.inject(atOnceUsers(1))   ).protocols(httpConf)  }<\/code><\/pre>\n<p>\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 API, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0432 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u0434\u043b\u044f <code>getAllVideoGames()<\/code>:<\/p>\n<pre><code class=\"scala\">  def getAllVideoGames() = {     repeat(3) {       exec(http(\"Get all video games - 1st call\")         .get(\"videogames\")         .check(status.is(200)))     }   }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>repeat(3)<\/code> &#8212; \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f 3 \u0440\u0430\u0437\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u0435\u0442 3 HTTP-\u0432\u044b\u0437\u043e\u0432\u0430).<\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 HTTP-\u0432\u044b\u0437\u043e\u0432 &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0438\u0433\u0440\u0443:<\/p>\n<pre><code class=\"scala\">def getSpecificVideoGame() = {     repeat(5) {       exec(http(\"Get specific game\")         .get(\"videogames\/1\")         .check(status.in(200 to 210)))     }   }<\/code><\/pre>\n<p>\u041c\u044b \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>repeat(5)<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 5 \u0440\u0430\u0437.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <strong>\u043f\u0430\u0443\u0437\u043e\u0439<\/strong> \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u0436\u0434\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0430 \u0441\u0430\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435:<\/p>\n<pre><code class=\"scala\">  val scn = scenario(\"Code reuse\")       .exec(getAllVideoGames())       .pause(5)       .exec(getSpecificVideoGame())       .pause(5)       .exec(getAllVideoGames())<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0441\u0442\u0438\u043b\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432 \u0441\u0432\u043e\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 Gatling \u0432\u044b \u0447\u0430\u0441\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043b\u0438 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b API.<\/p>\n<hr>\n<blockquote>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u0443\u0440\u0441\u0435 <a href=\"https:\/\/otus.pw\/dS3d\/\"><strong>\u00ab\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb.<\/strong><\/a> <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u0434\u0435\u043c\u043e-\u0443\u0440\u043e\u043a\u0430 <a href=\"https:\/\/otus.pw\/04bb\/\"><strong>\u00abLoadRunner: \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb<\/strong><\/a>.<\/p>\n<\/blockquote>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/554620\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/554620\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/dS3d\/\"><strong>\u00ab\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb.<\/strong><\/a> <\/p>\n<\/blockquote>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<hr>\n<h2>4. \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u2014 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/h2>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/552846\/\">\u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/a> \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/a> (Video Game Database). \u042d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439, \u043a\u0430\u043a \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0432\u044b\u0434\u0443\u043c\u0430\u043d\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440. \u041e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c API, \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/swagger.io\/\">Swagger,<\/a> \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 HTTP-\u043a\u043e\u043c\u0430\u043d\u0434\u044b (Get, Put, Update, Delete) \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 XML \u0438 JSON \u043f\u0435\u0439\u043b\u043e\u0430\u0434\u044b.<\/p>\n<p>\u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 (\u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435) <a href=\"https:\/\/github.com\/james-willett\/VideoGameDB\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> \u0438 \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u0432\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0435\u0433\u043e \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041e\u0442\u0442\u0443\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e:<\/p>\n<ul>\n<li>\n<p><strong>Gradle<\/strong> \u2014 <code>.\/gradlew bootRun<\/code><\/p>\n<\/li>\n<li>\n<p><strong>Maven<\/strong> \u2014 <code>mvn spring-boot:run<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043d\u0435\u043c\u0443 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443: <a href=\"http:\/\/localhost:8080\/swagger-ui\/index.html#\/\">http:\/\/localhost:8080\/swagger-ui\/index.html#\/<\/a><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 Swagger \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption>Video Game Database<\/figcaption><\/figure>\n<p>\u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0432\u0430\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u044b\u043a\u0430\u0442\u044c API \u0447\u0435\u0440\u0435\u0437 Swagger, \u043f\u0440\u043e\u0431\u0443\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0441 XML \u0438 JSON.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 (\u0438\u043b\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435) \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432\u0435\u0440\u0441\u0438\u044e <\/em><a href=\"http:\/\/video-game-db.eu-west-2.elasticbeanstalk.com\/swagger-ui\/index.html\"><em>\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440 \u043d\u0430 AWS<\/em><\/a><em>. \u041f\u0440\u0438\u0447\u0438\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439, \u0443 \u043a\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e\u0442 AWS \u0430\u0434\u0440\u0435\u0441, \u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435!<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling.<\/p>\n<hr>\n<h2>5. \u041e\u0441\u043d\u043e\u0432\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling<\/h2>\n<p>\u0412 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Gatling \u0441 \u0446\u0435\u043b\u044c\u044e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 <em>\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439<\/em> \u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e <strong>\u043f\u0430\u043a\u0435\u0442\u0430<\/strong> \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043f\u043a\u0438 <em>scala<\/em> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448\u0438 Gatling \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u041d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 simulations.<\/p>\n<h3>5.1 \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430&nbsp; Gatling<\/h3>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Scala<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>MyFirstTest<\/code>. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  class MyFirstTest extends Simulation {    &nbsp;&nbsp;\/\/ 1 Http Conf (\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Http)&nbsp; &nbsp;&nbsp;val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\") &nbsp;&nbsp;&nbsp;&nbsp;.header(\"Accept\", \"application\/json\") &nbsp;&nbsp;&nbsp;&nbsp;.proxy(Proxy(\"localhost\", 8888))    &nbsp;&nbsp;\/\/ 2 Scenario Definition (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f) &nbsp;&nbsp;val scn = scenario(\"My First Test\") &nbsp;&nbsp;&nbsp;&nbsp;.exec(http(\"Get All Games\") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.get(\"videogames\"))    &nbsp;&nbsp;\/\/ 3 Load Scenario (\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438) &nbsp;&nbsp;setUp( &nbsp;&nbsp;&nbsp;&nbsp;scn.inject(atOnceUsers(1)) &nbsp;&nbsp;).protocols(httpConf) }<\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 Gatling, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:8080\/app\/videogames\">http:\/\/localhost:8080\/app\/videogames<\/a>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<h4>5.1.1 \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0430<\/h4>\n<p>\u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0434\u0432\u0430 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre><code class=\"scala\">import io.gatling.core.Predef._ import io.gatling.http.Predef._<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u043a\u0435\u0442\u044b Gatling &#8212; \u043e\u043d\u0438 <em>\u043e\u0431\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling<\/em>.<\/p>\n<h4>5.1.2 Extends Simulation<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 <code>Scala<\/code> \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 <code>Gatling Simulation<\/code>:<\/p>\n<pre><code class=\"scala\">class MyFirstTest extends Simulation {<\/code><\/pre>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 Gatling, \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Simulation \u043f\u0430\u043a\u0435\u0442\u0430 Gatling.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 3 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438:<\/p>\n<h4>5.1.3 \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP (Http Conf)<\/h4>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c <strong>\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e HTTP<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Gatling.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"scala\">\/\/ 1 Http Conf val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\") &nbsp;&nbsp;&nbsp;&nbsp;.header(\"Accept\", \"application\/json\")<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c <code>baseUrl<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u0430\u0445 API \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435.<\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (header), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435, <strong>Accept -&gt; application\/json<\/strong>.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b &#8212; \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 <a href=\"https:\/\/gatling.io\/docs\/current\/http\/http_protocol\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Gatling \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP<\/a>.<\/p>\n<h4>5.1.4 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f (Scenario Definition)<\/h4>\n<p>\u0421\u0435\u043a\u0446\u0438\u044f<strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f <\/strong>\u044d\u0442\u043e \u0442\u043e \u043c\u0435\u0441\u0442\u043e<strong> <\/strong>\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 Gatling, \u0433\u0434\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0448 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c (user journey). \u042d\u0442\u043e \u0448\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c 5 \u0441\u0435\u043a\u0443\u043d\u0434<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u044b<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0438 \u0442. \u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e GET \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 videogames. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u0430\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 <a href=\"http:\/\/localhost:8080\/app\/videogames\">http:\/\/localhost:8080\/app\/videogames<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 <strong>baseUrl<\/strong> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 HTTP \u0432\u044b\u0448\u0435:<\/p>\n<pre><code class=\"scala\">\/\/ 2 Scenario Definition (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f) val scn = scenario(\"My First Test\")         &nbsp; .exec(http(\"Get All Games\") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        .get(\"videogames\"))<\/code><\/pre>\n<h4>5.1.5 &#8212; \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h4>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Gatling \u2014 \u044d\u0442\u043e <strong>\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/strong>. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0430\u043a \u0434\u043e\u043b\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0442. \u0434.) \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0430 Gatling. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u043e <em>\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0435\u0439<\/em><\/p>\n<pre><code class=\"scala\">\/\/ 3 Load Scenario (\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438) setUp( &nbsp;&nbsp;&nbsp;scn.inject(atOnceUsers(1)) &nbsp;&nbsp;&nbsp;).protocols(httpConf)<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0443 \u043d\u0430\u0441 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 Gatling! \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043b\u0430\u0441\u0441 <code>Engine<\/code> \u0438 \u0432\u044b\u0431\u0440\u0430\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 <code>MyFirstTest<\/code>:<\/p>\n<figure class=\"full-width\"><figcaption>My First Gatling Test<\/figcaption><\/figure>\n<p>\u042d\u0442\u0438 3 \u0447\u0430\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432\u0441\u0435\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Gatling:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f HTTP<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Gatling:<\/p>\n<h3>5.2 \u041f\u0430\u0443\u0437\u0430 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0434\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0443\u0437\u044b (pause) \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 HTTP.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Scala \u0432 \u043f\u0430\u043f\u043a\u0435 <em>simulations<\/em> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>CheckResponseCode<\/code>. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  import scala.concurrent.duration.DurationInt  class CheckResponseCode extends Simulation {    val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\")     .header(\"Accept\", \"application\/json\")    val scn = scenario(\"Video Game DB - 3 calls\")      .exec(http(\"Get all video games - 1st call\")       .get(\"videogames\")       .check(status.is(200)))     .pause(5)      .exec(http(\"Get specific game\")       .get(\"videogames\/1\")       .check(status.in(200 to 210)))     .pause(1, 20)      .exec(http(\"Get all Video games - 2nd call\")       .get(\"videogames\")       .check(status.not(404), status.not(500)))     .pause(3000.milliseconds)    setUp(     scn.inject(atOnceUsers(1))   ).protocols(httpConf)  }<\/code><\/pre>\n<h4>5.2.1 \u041f\u0430\u0443\u0437\u044b<\/h4>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c 3 \u0432\u044b\u0437\u043e\u0432\u0430 API. \u041e\u0434\u0438\u043d \u043a <strong>videogames<\/strong>, \u0437\u0430\u0442\u0435\u043c \u043e\u0434\u0438\u043d \u043a <strong>videogames\/1<\/strong>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043a <strong>videogames<\/strong>.<\/p>\n<p>\u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u0443\u0437\u044b \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>18<\/strong> \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>.pause(5)<\/code> &#8212; \u044d\u0442\u043e \u043f\u0430\u0443\u0437\u0430 \u043d\u0430 5 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>24<\/strong> \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 <code>.pause(1, 20)<\/code> &#8212; \u044d\u0442\u043e \u043f\u0430\u0443\u0437\u0430 \u043d\u0430 <em>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435<\/em> \u0432\u0440\u0435\u043c\u044f \u043e\u0442 1 \u0434\u043e 20 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>29<\/strong> \u0443 \u043d\u0430\u0441 <code>.pause(3000.milliseconds)<\/code> &#8212; \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e \u0441\u043a\u0440\u0438\u043f\u0442 Gatling \u043d\u0430 3000 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0427\u0442\u043e\u0431\u044b Gatling \u043c\u043e\u0433 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c <strong>milliseconds<\/strong>, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>scala.concurrent.duration.DurationInt<\/code> \u0432 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<h4>5.2.2 \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0434\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430<\/h4>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 API Gatling \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0441\u0441\u0435\u0440\u0442\u0443, Gatling \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>17 <\/strong>\u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 <code>.check(status.is(200)))<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 &#8212; 200.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>23<\/strong> \u0443 \u043d\u0430\u0441 <code>.check(status.in(200 to 210)))<\/code>, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 200 \u0434\u043e 210.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <strong>28<\/strong> \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u041d\u0415 \u0431\u044b\u043b \u0447\u0435\u043c-\u0442\u043e \u0438\u0437 <code>.check(status.not(404, status.not(500)))<\/code> &#8212; \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 404 \u0438\u043b\u0438 500.<\/p>\n<h3>5.3 \u041a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u0432 Gatling \u0441 Check API<\/h3>\n<p>Check API \u0432 Gatling \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0432\u0435\u0449\u0435\u0439:<\/p>\n<ul>\n<li>\n<p>\u0410\u0441\u0441\u0435\u0440\u0442\u0430, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/jsonpath.com\/\">JSONPath<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c JSONPath \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 <em>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439<\/em>. \u0410 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u044d\u0442\u0443<\/strong> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0435 API.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0435\u0439 (correlation) <\/strong>\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 <em>simulations <\/em>\u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>CheckResponseBodyAndExtract<\/code>. \u0412\u043e\u0442 \u0435\u0433\u043e \u043a\u043e\u0434:<\/p>\n<pre><code class=\"scala\">package simulations  import io.gatling.core.Predef._ import io.gatling.http.Predef._  class CheckResponseBodyAndExtract extends Simulation {    val httpConf = http.baseUrl(\"http:\/\/localhost:8080\/app\/\")     .header(\"Accept\", \"application\/json\")    val scn = scenario(\"Check JSON Path\")        \/\/ First call - check the name of the game       .exec(http(\"Get specific game\")       .get(\"videogames\/1\")       .check(jsonPath(\"$.name\").is(\"Resident Evil 4\")))        \/\/ Second call - extract the ID of a game and save it to a variable called gameId       .exec(http(\"Get all video games\")       .get(\"videogames\")       .check(jsonPath(\"$[1].id\").saveAs(\"gameId\")))        \/\/ Third call - use the gameId variable saved from the above call       .exec(http(\"Get specific game\")       .get(\"videogames\/${gameId}\")       .check(jsonPath(\"$.name\").is(\"Gran Turismo 3\"))    setUp(     scn.inject(atOnceUsers(1))   ).protocols(httpConf)  }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c 3 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 API. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c JSONPath, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 <strong>name<\/strong> \u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c JSON \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 <em>Resident Evil 4<\/em> :<\/p>\n<pre><code class=\"scala\">  .exec(http(\"Get specific game\")   .get(\"videogames\/1\")<\/code><\/pre>\n<\/hr>\n<\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322203","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322203"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322203\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}