Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.44 KB | None | 0 0
  1. package computerdatabase
  2.  
  3. import scala.concurrent.duration._
  4. import io.gatling.core.Predef._
  5. import io.gatling.http.Predef._
  6.  
  7. class PTBI extends Simulation {
  8.   // Optional, Flood IO will pass in threads, rampup and duration properties from UI
  9.   val threads   = Integer.getInteger("threads",  100)
  10.   val rampup    = Integer.getInteger("rampup",   540).toLong
  11.   val duration  = Integer.getInteger("duration", 1200).toLong
  12.   val environment = "http://"+System.getProperty("environment")
  13.   println(environment)
  14.  
  15.   val httpConf = http
  16.     .baseURL(environment) // Here is the root for all relative URLs
  17.     .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
  18.     .doNotTrackHeader("1")
  19.     .acceptLanguageHeader("en-US,en;q=0.5")
  20.     .acceptEncodingHeader("gzip, deflate")
  21.     .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
  22.  
  23.   // define the feeder
  24.   val urlList = csv("ptbiurls.csv").random
  25.  
  26.   // define the scenario
  27.   val scn = scenario("TEST")
  28.  
  29.     .exec(
  30.             http("login")
  31.             .get("/analytics/saw.dll?Logon&NQUser=weblogic&NQPassword=pt4wlsuat&Impersonate=nadavati")
  32.             .check(status.is(200))
  33.             ).pause(5)
  34.            
  35.     .repeat(100) {     
  36.         feed(urlList)
  37.         .exec(
  38.             http("${URL}")
  39.             .get("${URL}")
  40.             .check(status.is(200))
  41.             ).pause(5)
  42.         }
  43.   setUp(scn.inject(rampUsers(threads) over (rampup seconds))).protocols(httpConf)
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement