# how to debug

**URL:** <https://community.gatling.io/t/how-to-debug/4888>\
**Category:** Gatling (Open-Source)\
**Created:** [March 28, 2019, 9:11am UTC](https://community.gatling.io/t/how-to-debug/4888 "2019-03-28T09:11:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AKSHETTY1982](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@AKSHETTY1982](https://community.gatling.io/u/AKSHETTY1982)\
**Post date:** [March 28, 2019, 9:11am UTC](https://community.gatling.io/t/how-to-debug/4888/1 "2019-03-28T09:11:32Z")

</div>

Hi ,

i have been working with Gatling for a week now.  
i have created the following scenario and i am running the test from the terminal in IntelliJ IDEA.  
I am able to see the console output of the POST Call but i am unable to see the GET Call during the polling.  
This makes me wonder if the scenario is working as intended.  
I have tried putting the log lines using exec(println(“This is a Log Line”)) but i see a error for the line where i put it.  
i intend to put the log line to verify the value of varable execUID.  
where can i put the line println(“execUID is “+”${execUID}” ?

```auto
val scn: ScenarioBuilder = scenario("Stress test scenario for records_included=All")
  .feed(feeder.customFeeder)
.repeat(3 , "counterName" ) {
  doWhile("$execState".equals("COMPLETED")) {
    exec(http("Submit Alerts for Execution").post("/_execute/?wait_for_completion_seconds=0")
      .body(StringBody(execution))
      .check(status.is(200))
      //.check(substring("COMPLETED").exists)
      .check(jsonPath("$.uid").saveAs("execUID")))
      .pause(1)
         .exec(
        polling.pollerName("Poller")
          .every(10)
          //.exec(http("Retrieve Execution Status").get("/_execute/"+"${execUID}"+"?wait_for_completion_seconds="+TestConfig.duration)
          .exec(http("Retrieve Execution Status").get("/_execute/" + "${execUID}" + "?wait_for_completion_seconds=" + TestConfig.duration)
          .check(status.is(200))
          .check(jsonPath("$.state").saveAs("execState"))
          .check(substring("COMPLETED").exists)))
          .pause(1)
          .exec(polling.pollerName("Poller").stop)
  }
}
setUp(
  scn.inject(atOnceUsers(TestConfig.usersFile))
).protocols(httpConf)

```

---

<div class="post-metadata">

**Author:** ![G\_Madhana\_Mohana\_Red](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@G\_Madhana\_Mohana\_Red](https://community.gatling.io/u/G_Madhana_Mohana_Red)\
**Post date:** [March 29, 2019, 4:00am UTC](https://community.gatling.io/t/how-to-debug/4888/2 "2019-03-29T04:00:41Z")

</div>

place the code before polling & after pause(1) to get to know the value exits or not.

.exec(session =\> {  
println(“execUID:” + session(“execUID”).as[String])  
println(session)  
session.set(“temp”,“temp”)  
})

If value “execUID” doesn’t exists then it would not go to GET call.

---

<div class="post-metadata">

**Author:** ![AKSHETTY1982](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@AKSHETTY1982](https://community.gatling.io/u/AKSHETTY1982)\
**Post date:** [March 29, 2019, 6:58am UTC](https://community.gatling.io/t/how-to-debug/4888/3 "2019-03-29T06:58:08Z")

</div>

Hi Madhana ,

The log lines are printing as below. i put the same block inside the polling after the GET Call as well.  
The session value cannot be accessed as ${execUID}.

how can i save the value of session(“execUID”).as[String]) in a variable and then use it within the GET Call ?  
Because i can’t use session(“execUID”).as[String]) within the GET call.

.exec(http(“Retrieve Execution Status”).get("/\_execute/" + session(“execUID”).as[String]) + “?wait\_for\_completion\_seconds=” + TestConfig.duration)

---

<div class="post-metadata">

**Author:** ![AKSHETTY1982](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@AKSHETTY1982](https://community.gatling.io/u/AKSHETTY1982)\
**Post date:** [March 29, 2019, 7:55am UTC](https://community.gatling.io/t/how-to-debug/4888/4 "2019-03-29T07:55:00Z")

</div>

hi Madhana ,

I was able to save the value in a var but still not able to invoke the GET.  
why is the GET within the polling not working . Latest code with he use of var below :

```auto
var execUID = "";

 val scn: ScenarioBuilder = scenario("Stress test scenario for records_included=All")
   .feed(feeder.customFeeder)
   .repeat(2, "counterName") {
     doWhile("$execState".equals("COMPLETED")) {
       exec(http("Submit Alerts for Execution").post("/_execute/?wait_for_completion_seconds=0")
         .body(StringBody(execution))
         .check(status.is(200))
         //.check(substring("COMPLETED").exists)
         .check(jsonPath("$.uid").saveAs("execUID")))
         .pause(1)
         .exec(session => {
            execUID = session("execUID").as[String]
           println("execUID ( Var ) :>>>>>>>>>>" + execUID)
           //println(session)
           session.set("temp","temp")
         })
         .exec(
           //polling.pollerName("Poller")
           polling.pollerName("Poller")
             .every(10)
             //.exec(http("Retrieve Execution Status").get("/_execute/"+"${execUID}"+"?wait_for_completion_seconds="+TestConfig.duration)
             .exec(http("Retrieve Execution Status").get("/_execute/" + execUID + "?wait_for_completion_seconds=" + TestConfig.duration)
             .check(status.is(200))
             .check(jsonPath("$.state").saveAs("execState"))
             .check(substring("COMPLETED").exists)))
         .pause(1)
         .exec(session => {
           println("execUID:>>>>>>>>>>222" + session("execUID").as[String])
           println("execUID:>>>>>>>>>>222" + "${execUID}")
           println("execUID ( Var2 ) :>>>>>>>>>>" + execUID)
           //println(session)
           session.set("temp","temp")
         })
         .exec(polling.pollerName("Poller").stop)
     }
   }
 setUp(
   scn.inject(atOnceUsers(TestConfig.usersFile))
 ).protocols(httpConf)

```

---

<div class="post-metadata">

**Author:** ![G\_Madhana\_Mohana\_Red](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@G\_Madhana\_Mohana\_Red](https://community.gatling.io/u/G_Madhana_Mohana_Red)\
**Post date:** [April 2, 2019, 4:38am UTC](https://community.gatling.io/t/how-to-debug/4888/5 "2019-04-02T04:38:17Z")

</div>

you can not pass variable directly to the GET call the one you shared. instead save the value and pass as parameter.

e.g…exec(http(“Retrieve Execution Status”).get("/\_execute/" + “${execUID}” + “?wait\_for\_completion\_seconds=” + "${TestConfig.duration})

---

<div class="post-metadata">

**Author:** ![AKSHETTY1982](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@AKSHETTY1982](https://community.gatling.io/u/AKSHETTY1982)\
**Post date:** [April 2, 2019, 8:01am UTC](https://community.gatling.io/t/how-to-debug/4888/6 "2019-04-02T08:01:45Z")

</div>

Hi Madhana ,

The commented line above the current GET call was the original implementation.  
But the GAT call is not invoked. the call is working if i remove the polling.  
what is wrong with this implementation.

This is my original implementation which is now commented.  
The execUID varibale is saved using saveas durong the first POST call.

```auto
//.exec(http("Retrieve Execution Status").get("/_execute/"+"${execUID}"+"?wait_for_completion_seconds="+TestConfig.duration)

```
