Cómo crear secuencias de comandos de Gatling con código VS

La traducción del artículo fue preparada en la víspera del inicio del curso "Prueba de carga" .








Prefacio



, , Gatling Fundamentals, , Gatling Visual Studio Code. , , , , — , , !



, Gatling VS Code. Maven SBT.



Metals



, , Maven SBT, Scala Metals VS Code. Scala VS Code , IDE.





VS Code , Extensions Scala (Metals):





Metals, , Gatling VS Code Maven.



Gatling VScode Maven



-, Maven — Maven .



Maven for Java VS Code:





- VS Code, Command Pallette (View > Command Pallette) Maven: Update Maven Archetype Catalog:





, Maven.



Gatling Gatling Maven. Command Pallette Maven: Create Maven Project. , more. Gatling, Gatling. :





. VS Code. , . Metals VS Code Import Build:





Maven .



Gatling . Gatling , :



package computerdatabase

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class BasicSimulation extends Simulation {

  val httpProtocol = http
    .baseUrl("http://computer-database.gatling.io") 
//       URL
    .acceptHeader(
      "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"

//   
    .acceptEncodingHeader("gzip, deflate")
    .acceptLanguageHeader("en-US,en;q=0.5")
    .userAgentHeader(
      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0"
    )

  val scn =
    scenario("Scenario Name") // A scenario is a chain of requests and pauses
      .exec(
        http("request_1")
          .get("/")
      )
      .pause(7) // Note that Gatling has recorder real time pauses

  setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}


, VS Code, mvn gatling:test. ,



mvn gatling:test -Dgatling.simulationClass=computerdatabase.BasicSimulation


Gatling Maven.



Gatling VScode SBT



Gatling Scala Build Tool (SBT), , Gatling SBT Plugin Demo.



, VS Code. Metals VS Code Import Build:





VS Code Gatling SBT.



, sbt gatling:test. , sbt gatling:testOnly computerdatabase.BasicSimulation.



Gatling SBT .





, Visual Studio Code Gatling . , Gatling Maven SBT.



, IntelliJ IDEA Scala Gatling, VS Code!






« »







All Articles