# basic script works, trying to loop and execute http requests does not

**URL:** <https://community.gatling.io/t/basic-script-works-trying-to-loop-and-execute-http-requests-does-not/1690>\
**Category:** Gatling (Open-Source)\
**Created:** [November 13, 2014, 6:51pm UTC](https://community.gatling.io/t/basic-script-works-trying-to-loop-and-execute-http-requests-does-not/1690 "2014-11-13T18:51:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harold\_Everett](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@Harold\_Everett](https://community.gatling.io/u/Harold_Everett)\
**Post date:** [November 13, 2014, 6:51pm UTC](https://community.gatling.io/t/basic-script-works-trying-to-loop-and-execute-http-requests-does-not/1690/1 "2014-11-13T18:51:32Z")

</div>

**working script:**

package rtwsimulation  
import com.excilys.ebi.gatling.core.Predef.\_  
import com.excilys.ebi.gatling.http.Predef.\_  
import com.excilys.ebi.gatling.jdbc.Predef.\_  
import com.excilys.ebi.gatling.http.Headers.Names.\_  
import akka.util.duration.\_  
import bootstrap.\_

class RTWBasic4 extends Simulation {  
[//10.1.20.169](https://10.1.20.169)  
val httpConf = httpConfig  
.baseURL(“[http://9.12.43.169:9080/RTW](http://9.12.43.169:9080/RTW)”)  
.acceptCharsetHeader(“ISO-8859-1,utf-8;q=0.7,_;q=0.7")  
.acceptHeader("text/html,application/xhtml+xml,application/xml,application/json;q=0.9,_/\*;q=0.8”)  
.acceptEncodingHeader(“gzip, deflate”)  
.acceptLanguageHeader(“fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3”)  
.disableFollowRedirect

val scn = scenario(“Scenario Name”) // A scenario is a chain of requests and pauses  
.exec(http(“request\_1”)  
.get("/RTWServlet?regions=4&program=0")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(2) // Note that Gatling has recorded real time pauses  
.exec(http(“request\_2”)  
.get("/RTWServlet?regions=4&program=1")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(2)  
.exec(http(“request\_3”)  
.get("/RTWServlet?regions=4&program=2")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(3)  
.exec(http(“request\_4”)  
.get("/RTWServlet?regions=4&program=3")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(2)  
.exec(http(“request\_5”)  
.get("/RTWServlet?regions=4&program=4")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(2)  
.exec(http(“request\_6”)  
.get("/RTWServlet?regions=4&program=5")  
.basicAuth(“LBTYUA”, “LBTYUA”))  
setUp(scn.users(10).ramp(10).protocolConfig(httpConf))

}

**This one loops but never actually executes the http request:**

package rtwsimulation  
import com.excilys.ebi.gatling.core.Predef.\_  
import com.excilys.ebi.gatling.http.Predef.\_  
import com.excilys.ebi.gatling.jdbc.Predef.\_  
import com.excilys.ebi.gatling.http.Headers.Names.\_  
import akka.util.duration.\_  
import bootstrap.\_  
import scala.util.Random

class RTW extends Simulation {  
//val browsers = java.lang.Integer.getInteger(“users”, 1)  
//val rampUp = java.lang.Long.getLong(“ramp”,0L)  
//val howManyTimes = Integer.getInteger(“loop”,1)  
//val ip = java.lang.System.getProperty(“ipaddress”)  
//val port = java.lang.System.getProperty(“appport”)  
val browsers = 10  
val rampUp = 10  
val howManyTimes = 1000  
val regions = 4  
val exuri = “[http://9.12.43.169:9080/RTW](http://9.12.43.169:9080/RTW)”  
val inuri = “[http://10.1.20.169:9080/RTW](http://10.1.20.169:9080/RTW)”  
val exuris = “[https://9.12.43.169:9443/RTW](https://9.12.43.169:9443/RTW)”  
val inuris = “[https://10.1.20.169:9443/RTW](https://10.1.20.169:9443/RTW)”

val httpConf = httpConfig  
.baseURL(exuri)  
.acceptCharsetHeader(“ISO-8859-1,utf-8;q=0.7,_;q=0.7")  
.acceptHeader("text/html,application/xhtml+xml,application/xml,application/json;q=0.9,_/\*;q=0.8”)  
.acceptEncodingHeader(“gzip, deflate”)  
.acceptLanguageHeader(“fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3”)  
.disableFollowRedirect

var i=0  
while (i \< howManyTimes) {  
var region = Random.nextInt(regions) + 1  
var program = Random.nextInt(7)  
var fullUri = “/RTWServlet?regions=” + region + “&program=” + program  
var scn = scenario(“Scenario Name” + i) // A scenario is a chain of requests and pauses  
exec(http(“request\_” + i).get(fullUri).basicAuth(“LBTYUA”, “LBTYUA”))  
.pause(2)  
i += 1  
setUp(scn.users(browsers).ramp(rampUp).protocolConfig(httpConf))  
}  
}

**I am not sure why but it does not execute the http requests and it dumps trying to report:**

Users : [#################################################################]100%  
waiting:0 / running:0 / done:10  
---- Scenario Name293 ----------------------------------------------------------  
Users : [#################################################################]100%  
waiting:0 / running:0 / done:10  
---- Requests ------------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 13, 2014, 7:07pm UTC](https://community.gatling.io/t/basic-script-works-trying-to-loop-and-execute-http-requests-does-not/1690/2 "2014-11-13T19:07:06Z")

</div>

You use Gatling 1 that we have EOL’ed. Please first upgrade to Gatling 2.

---

<div class="post-metadata">

**Author:** ![Harold\_Everett](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@Harold\_Everett](https://community.gatling.io/u/Harold_Everett)\
**Post date:** [November 13, 2014, 7:12pm UTC](https://community.gatling.io/t/basic-script-works-trying-to-loop-and-execute-http-requests-does-not/1690/3 "2014-11-13T19:12:14Z")

</div>

I tried to upgrade yesterday, gatling does a check to make sure the level of SDK is 7U6 or above. This check fails for IBM SDKs. I run on zLinux, the only SDK for zLinux is IBM. Was considering how to proceed with the problem?
