Reputation: 79
We are using JMeter to test load for some simple html pages (GET requests for a total of ~1.5 hour). In order to test server ehcache mechanism (forcing cache store etc.), we are using a query param named ts in pages' request path as following:
Path: SERVER_NAME/page1?ts=${__time(Y-M-D-H-mm)}
This will create different requests per minute/hour/ etc - (of course different threads can use same timestamp value ts). As an example:
Is it possible to allow timestamp value only after predefined amount of minutes? E.g. for previous example if we want 5 minutes:
Thanks.
Upvotes: 0
Views: 268
Reputation: 168082
One of possible solutions would be pre-generating the timestamps and writing them into the CSV file somewhere in setUp Thread Group using JSR223 Sampler and the code like:
import groovy.time.TimeCategory
def now = new Date()
def numberOfLinesInCsv = 100
use(TimeCategory) {
1.upto(numberOfLinesInCsv, {
now = now + 5.minutes
new File('ts.csv') << (now.format('Y-M-D-H-mm')) << System.getProperty('line.separator')
})
}
Once done you can add CSV Data Set Config in the main Thread Group and configure it to read ts.csv
file.
Upvotes: 1