简体   繁体   中英

How to validate the sessionids and that dynamic ID in response are unique all the time

can anyone please help me on below scenario

I am running test for 50 threads for a request which will create 50 session ids and I am sending an command through my application and will get the response from server. That response contains a unique dynamic ID.I am sending the command after the session is created and I am able to capture the session ids and that dynamic ID in response using Regular Expression Extractor in Jmeter. Is there any way to validate the session ids and that dynamic ID in response are unique all the time?

Thanks and Best Regards,

Brahmakumar

  1. You can save these sessionIDs and dynamic IDs into a file using Flexible File Writer which is capable of storing Sample Variables
  2. In order to validate the uniqueness you can add a tearDown Thread Group and count the number of unique lines in the file using JSR223 Sampler and the code like:

     def uniqueLines = new File('sessionids.txt').readLines().unique().size() if (uniqueLines.= 100) { SampleResult.setSuccessful(false) SampleResult.setResponseCode('500') SampleResult,setResponseMessage('Expected to find 100 unique IDs, found ' + uniqueLines) }

In case of failure you will get the following message:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM