Reputation: 39
I'm doing a performance test of a HTTP Patch Method Request using Jmeter called 'Update Person'. The case here is the Update Person is dependent on another request called 'Create Person'. Create Person will return a 'personId' as a response and I will use that id to send an update request. So I can't do a performance test with only the Update Person Request. Here is my Jmeter Test Plan Layout:
When I run the test plan, the performance of both request is significantly slower than testing the Create Person alone. My questions are:
Thank you.
Upvotes: 1
Views: 367
Reputation: 1999
1.You can first run the create person alone and get all the required person ids in the csv. For this you can use the post processors and capture and write the output or take it directly from DB if it is there and you can. 2. Then, pass the created ids to the second request from the csv using CSV Data Set config.
Update:-
Use regex or any post processor for fetching the UserId then with in the same sampler use BeanShell PostProcessor to write the output to csv:-
Ex:-
CreatePerson = vars.get("Create_Person");
f = new FileOutputStream("C:/Users/XXX/Users.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(CreatePerson);
f.close();
This can also be achieved with Groovy for performance improvement. I am not an expert on Groovy but you can find that on this site. Dmitri T has submit that many times.
Then, for reading it is very easy. Add "CSV Data Set Config" before the samplers or on top to fetch the data. Column name need to be passed as variable where it is required like ${CreatePerson}
There is one more thing to capture the data instead of code. Use Sample Variable. In the user.properties(under bin folder) file add a line in the end:-sample_variables=CreatePerson
Then, use simple data writer or view result listener to save the results in the csv. It should write the data in the csv. You can deselect all the data that is not required from the simple data writer/view result listener.
Upvotes: 0