mpmiszczyk / gatling-funspec-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gatling functional tests example project

Example project setup for using the new functional testing functionality coming in Gatling 2.2.0.

Using it you can writing functional tests in Gatling even easier then before.

Use sbt test to run the example

Example code

From GatlingFunSpecExample

class GatlingFunSpecExample extends GatlingHttpFunSpec {

  val baseURL = "http://example.com"

  spec {
    http("Example index.html test")
      .get("/index.html")
      .check(h1.exists)
  }

}

object GatlingFunSpecExample {
  def h1 = css("h1")
}

Running the example.

All you need to do to run the example is clone this repository and then in the project root

  • sbt test runs the TraditionalUnitTest inside src/test
  • sbt gatling:testruns the GatlingFunSpecExample inside src/test
  • sbt it:testruns the Integration Test Example io.gatling.funspec.example.GatlingFunSpecExampleIT inside src/it

Note: you need to put the it scope into the Ivy projectDependencies definition in order to make the it tests compile:

lazy val projectDependencies = Seq(
  "org.scalatest"                   %% "scalatest"                  % "2.2.3"          % "test,it",
  "io.gatling.highcharts"           % "gatling-charts-highcharts"   % "2.2.0"          % "test,it",
  "io.gatling"                      % "gatling-test-framework"      % "2.2.0"          % "test,it"
)

Building from SNAPSHOTs

# from the gatling-funspec-example directory
cd ..
git clone git@github.com:gatling/gatling.git
cd gatling
sbt publish-local
cd ..
git clone git@github.com:gatling/gatling-sbt.git
cd gatling-sbt
sbt publish-local

About


Languages

Language:Scala 100.0%