Search code examples
jdbcjmeterperformance-testing

How to loop through jdbc request in while loop until the column has certain value in JMeter


I have to fire up a request to the oracle server. The request just creates a job which runs on background and updates a field (say STATUS) in database. From JMeter, After firing the request, the resultset contains some value like "your job is running". Now I have to loop through the JDBC request to capture the fiend STATUS until its value is "Ready". When it is so, then then the request should stop, and I need the time from firing of first request to the time it took to change the status to ready. For this I added the following components

 - THREAD GROUP
 - JDBC CONNECTION CONFIGURATION
 - WHILE Controller (  condition = (${status.get(0).get("STATUS")}!="READY")    )
    -- JDBC Request (Result variable name = status )
 - Tree View Listener

The problem is, the while loop keeps executing even if the value of resultset is "READY", which is visible in the Tree View Listener. Please somebody tell me what should I do.?


Solution

  • I tried the following and it Worked.

    
    THREAD GROUP
    JDBC CONNECTION CONFIGURATION
    .. WHILE Controller ( ${__javaScript("${status_1}" != "READY")} )
      .. JDBC Request ( Variable name = status )
    Listeners