First, the background:
use JMeter to do interface testing, background is MongoDB, it is inevitable to connect access.
1, JMeter itself originally has MONGODB.JMX script sample, but now is not recommended to use.
2, can only think of another way, because do not understand Java, so decided to take JMeter JSR request, through groovy script way, access to MongoDB.
3, encountered the pit: link failure, prompting no permissions.
(Depressed for several days, check many times the script, the test script itself is very simple, tossing and turning those lines, feel no problem.) An accidental accident to find the reason. So for idiots, luck is too important.
Accidental accidental: A few days ago access to a shared address, others can access, I cannot access, the hint is probably the Group Policy is forbidden to access the shared folder, modified the settings to access success. Then I immediately associate with the database access problem, according to the original way, did not change what, the request came back data .... So the problem is not necessarily in the matter itself, it may be the influence of other places.
Second, record the next step
1, if you want to connect and operate the MongoDB database, must be driver, I looked for 3 from the Internet package:
Mongodb-driver-3.4.0-rc1
Mongo-java-driver-3.4.0-rc1
gmongo-1.5
Put them under the JMeter lib/ext path, and when you create a test plan, quote:
2, the connection parameters are defined first, placed in the "user-defined variables", easy to use.
3. Create a JSR request
4, look at the results, I in the local MongoDB database, in advance to create a database: MyDB, set: MyDB, which put some simple test data.
JMeter via groovy script to connect MongoDB