Rishi
Rishi

Reputation: 115

Jmeter - Can I change a variable halfway through runtime?

I am fairly new to JMeter so please bear with me.

I need to understand whist running a JMeter script I can change the variable with the details of "DB1" to then look at "DB2".

Reason for this is I want to throw load at a MongoDB and then switch to another DB at a certain time. (hotdb/colddb)

Upvotes: 2

Views: 100

Answers (2)

MonkeyTester
MonkeyTester

Reputation: 139

How about reading the value from a file in a beanshell/javascript sampler each iteration and storing in a variable, then editing/saving the file when you want to switch? It's ugly but it would work.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168207

The easiest way is just defining 2 MongoDB Source Config elements pointing to separate database instances and give them 2 different MongoDB Source names.

Then in your script you will be able to manipulate MongoDB Source parameter value in the MongoDB Script test element or in JSR223 Samplers so your queries will hit either hotdb or colddb

See How to Load Test MongoDB with JMeter article for detailed information

Upvotes: 2

Related Questions