0
votes

How to establish the connection with mongo dB using jmeter with JSR223 sampler? Whenever i am trying to establish connection it is failing without any response.I am suspecting this is due to auth mechanism.

Any help with necessary changes needs to be done on jmeter is much appreciated

1

1 Answers

0
votes

Whenever you face an issue with your script always check jmeter.log file, it should normally contain the root cause or at least enough information to guess it.

If you're looking for a built-in JMeter way of load testing MongoDB you will need to add the next line to user.properties file:

not_in_menu

This way you will have MongoDB Source Config back and will be able to specify your MongoDB host, port and other connection parameters. Later in JSR223 Sampler you will be able to get db object like:

def db = MongoDBHolder.getDBFromSource('sourceName', 'databaseName')

or if you need to supply the credentials:

def db = MongoDBHolder.getDBFromSource('sourceName', 'databaseName', 'username', 'password') 

More information: How to Load Test MongoDB with JMeter