PavanMudigondaTR opened a new issue, #6273:
URL: https://github.com/apache/jmeter/issues/6273

   ### Expected behavior
   
   I would expect to create sample labels dynamically using JSR223 listener in 
groovy
   
   ### Actual behavior
   
   unable to see custom label names. please see groovy below
   
   <img width="1224" alt="image" 
src="https://github.com/apache/jmeter/assets/86745613/ff487e9b-256d-48f9-ba1d-794384c595ff";>
   
   
   ### Steps to reproduce the problem
   
   ```
   import org.apache.jmeter.samplers.SampleResult
   
   def createSampleResult(String label, String message, String data, long 
startTime, long endTime) {
       def result = new SampleResult()
   
       result.setSampleLabel(label)
       result.setStartTime(startTime)
       result.setEndTime(endTime)
       log.info("Start Time for ${label} should be: " + (new 
Date(startTime)).toString())
       Thread.sleep(3000)
       result.setResponseCode("200")
       result.setSuccessful(true)
       result.setResponseMessage(message)
       result.setResponseData(data, "UTF-8")
       log.info("${label} label after ending: " + result.getSampleLabel())
   
       return result
   }
   
   def results = []
   def teardownThreadGroup = {
       // This is your loop
       for (int i = 0; i < 10; i++) {
           log.info("******************Sample Number ${i + 
1}********************")
           long startTime = System.currentTimeMillis()
           Thread.sleep(5000) // simulate some delay
           long endTime = System.currentTimeMillis()
   
           SampleResult result = createSampleResult("Sample ${i + 1}", "This is 
message returned from JSR223 script for Sample ${i + 1}", "You will see this 
sentence in Response Data tab for Sample ${i + 1}", startTime, endTime)
           results.add(result)
       }
   }
   
   teardownThreadGroup()
   // Return the last SampleResult
   return results[-1]
   ```
   
   ### JMeter Version
   
   latest
   
   ### Java Version
   
   corretto 17
   
   ### OS Version
   
   mac


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to