How to add a condition count > 8 in Gatling script?
<p>I want to add a below condition in http request, which gives me KO status if that condition matches.
My condition is <code>WorkflowFailed = True OR count &gt; 8</code> then status will be failed.</p>

<p>For one of the above condition <code>WorkflowFailed = True</code> I have added below code and it works fine, but for <code>count &gt; 8</code> it doesnt work.</p>

<pre><code>.check(jsonPath("$.failed").transform(status =&gt; status == "true").is(false))
</code></pre>

<p>I have also tried with this code, but didn't work and throws error.</p>

<pre><code>.check(jsonPath("$.failed").transform(status =&gt; status == "true" || count &gt; 8).is(false))
</code></pre>

<blockquote>
  <p>19:00:52.143 [ERROR] i.g.c.ZincCompiler$ -
  D:...\gatling-charts-highcharts-bundle-2.1.7\user-file
  s\simulations\LaunchResources.scala:83: value > is not a member of
  java.util.concurrent.atomic.AtomicInteger 19:00:52.144 [ERROR]
  i.g.c.ZincCompiler$ -<br>
  .check(jsonPath("$.failed"). transform(status => status == "true" ||
  count > 8).is(false)) 19:00:52.144 [ERROR] i.g.c.ZincCompiler$ -
                                                ^ 19:00:52.222 [ERROR] i.g.c.ZincCompiler$ - one error found</p>
</blockquote>

<p>Here is the code,</p>

<pre><code>class LaunchResources extends Simulation {

    val scenarioRepeatCount = Integer.getInteger("scenarioRepeatCount", 1).toInt
    val userCount = Integer.getInteger("userCount", 1).toInt
    val UUID  = System.getProperty("UUID", "24d0e03")
    val username = System.getProperty("username", "p1")
    val password = System.getProperty("password", "P12")
    val testServerUrl = System.getProperty("testServerUrl", "https://someurl.net")
    val count = new java.util.concurrent.atomic.AtomicInteger(0)

    val httpProtocol = http
        .baseURL(testServerUrl)
        .basicAuth(username, password)
        .connection("""keep-alive""")
        .contentTypeHeader("""application/vnd+json""")


    val headers_0 = Map(
        """Cache-Control""" -&gt; """no-cache""",
        """Origin""" -&gt; """chrome-extension://fdmmgasdw1dojojpjoooidkmcomcm""")

    val scn = scenario("LaunchAction")
        .repeat (scenarioRepeatCount) {
            exec(http("LaunchAResources")
                .post( """/api/actions""")
                .headers(headers_0)
                .body(StringBody(s"""{"UUID": "$UUID", "stringVariables" : {"externalFilePath" : "/Test.mp4"}}"""))
                .check(jsonPath("$.id").saveAs("WorkflowID")))

        .exec(http("SaveWorkflowStatus")
                .get("""/api/actions/{$WorkflowID}""")
                .headers(headers_0)
                .check(jsonPath("$.status").saveAs("WorkflowStatus")))

        }

     .asLongAs(session =&gt; session.attributes("WorkflowStatus") != "false" &amp;&amp; count.getAndIncrement() &lt; 8) {
        doIf(session =&gt; session("WorkflowFailed").validate[String].map(WorkflowFailed =&gt; !WorkflowFailed.contains("true")).recover(true)) 
        {
        pause(pauseTime)
        .exec(http("SaveWorkflowStatus")
                .get("""/api/actions/${WorkflowID}""")
                .headers(headers_0)
                .check(jsonPath("$.running").saveAs("WorkflowStatus"))
                .check(jsonPath("$.failed").saveAs("WorkflowFailed"))
                .check(jsonPath("$.failed").transform(status =&gt; status == "true").is(false))     // Added this line to fail 1st condition which is (WorkflowFailed = True) then mark as KO. Works fine.
                )

        .exec(session =&gt; {
                val wflowStatus1 = session.get("WorkflowStatus").asOption[String]
                val wflowFailed1 = session.get("WorkflowFailed").asOption[String]
                println("Inner Loop Workflow Status: ========&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; " + wflowStatus1.getOrElse("COULD NOT FIND STATUS"))
                println("Inner Loop Workflow Failed?? ========&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; " + wflowFailed1.getOrElse("COULD NOT FIND STATUS"))
                println("Count =====&gt;&gt; " + count)
                session}) 
        }
        }   

    setUp(scn.inject(atOnceUsers(userCount))).protocols(httpProtocol)

}
</code></pre>