# How to intentionally fail the transactions if the condition is not satisfied in 1 minutes duration in doWhileDuring

**URL:** <https://community.gatling.io/t/how-to-intentionally-fail-the-transactions-if-the-condition-is-not-satisfied-in-1-minutes-duration-in-dowhileduring/6786>\
**Category:** Gatling (Open-Source)\
**Created:** [May 24, 2022, 2:25pm UTC](https://community.gatling.io/t/how-to-intentionally-fail-the-transactions-if-the-condition-is-not-satisfied-in-1-minutes-duration-in-dowhileduring/6786 "2022-05-24T14:25:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![selva4](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@selva4](https://community.gatling.io/u/selva4)\
**Post date:** [May 24, 2022, 2:25pm UTC](https://community.gatling.io/t/how-to-intentionally-fail-the-transactions-if-the-condition-is-not-satisfied-in-1-minutes-duration-in-dowhileduring/6786/1 "2022-05-24T14:25:41Z")

</div>

the group has two endpoints, one is uploading data, on the other hand, the second end point is looped until it shows desired response message, and also duration also set to exit the loop…

Right it exits the Loop after the given duration is over, but not failing

How to intentionally fail the group transactions if the desired response not getting in the given time?

```auto
 .group("T05_EntireProcessingTime") {
      pause(t_pauseTime)
      .exec(
        http("T02_runInstantExport")
          .post("/runjob/runInstantExport")
          .header("Authorization", "${GCP_IAAP_AUTH_TOKEN}")
          .headers(correlated0Headers)
          .body(StringBody("""${payLoad}""")).asJson
          .check(status.is(200))
          .check(regex("\"listMetadataId\":(.*?),").saveAs("C_listMetadataId"))

          )
       // tryMax(20) {
          .pause(5)
            .doWhileDuring(session => session("statuss").as[String] == "INPROCESS",session => 1.minutes, "counter", true) {
              exec(
                http("T04_Polling")
                  .get("/runjob/${C_listMetadataId}/exportStatus")
                  .header("Authorization", "${GCP_IAAP_AUTH_TOKEN}")
                  .headers(correlated0Headers)
                  .check(
                    status.is(200),
                   // jsonPath("$..status").is("FINISHED"),
                    jsonPath("$..status").saveAs("statuss")

                  )
              )
                .pause(5)
            } // dowhile
      // } // try max
      }// group

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [May 24, 2022, 10:07pm UTC](https://community.gatling.io/t/how-to-intentionally-fail-the-transactions-if-the-condition-is-not-satisfied-in-1-minutes-duration-in-dowhileduring/6786/2 "2022-05-24T22:07:47Z")

</div>

If statuss is still INPROCESS after the loop, mark the Session as failed.

> **[Session API](https://gatling.io/docs/gatling/reference/current/core/session/session_api/#handling-session-state)**
>
> Concepts of the Gatling Session API
