solmazabbaspour / gatling-command-protocol

A gatling protocol that supports commandline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gatling Command Protocol

Gatling protocol that allows running load test using commandline commands.

Status

Gatling version 3.3.0

Usage

  • Copy the contents of the commandprotocol under your gatling simulations folder.
  • Import the protocol in your scenario using import commandprotocol.Predef._
  • Create a new command protocol as below:
val commandProtocol = script
.set()
  • Use the script protocol in your scenario
val scn = scenario("CommandSimulation")
  .exec((session: Session) => {
    session.set("path", "")
  })
  .pause(5)
  //STEP 1. Clone a random repo into ${clonePath}
  .exec((session: Session) => {
    val command = "mkdir /tmp/commandtest"
    session.set("command", command)
  })
  .exec(command("CreateDirectory").run())
  .pause(5)
  //STEP 1. Clone a random repo into ${clonePath}
  .exec((session: Session) => {
    val command = "rm -rf /tmp/commandtest"
    session.set("command", command)
  })
  .exec(command("RemoveDirectory").run())
  .pause(5)

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

Test

A simple test has been created to showcase the usage of this protocol. This scenario will create a directory under /tmp/commandtest and then will remove it in the next command. Under test/bin Run ./run-test.sh -s commandTest.TestSimulation

Gatling Report

Gatling report

Commands that return a non zero code will be marked as KO.

About

A gatling protocol that supports commandline

License:GNU General Public License v3.0


Languages

Language:Scala 67.6%Language:Shell 32.4%