Skip to content

solmazabbaspour/gatling-command-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.