0

Test Plan :

* Recording Controller#1
    > CSV UserName DateSet
    > HTTP Request#1
    > HTTP Request#2
        - HttpHeader Manager
        - Regular Expression Extractor
        - JSR223 PostProcess [To Set property for UniqueTokenId value ]
    > HTTP Request#3
        - HttpHeader Manager [Passing UniqueTokenId value]
    > HTTP Request#4
        - HttpHeader Manager [Passing UniqueTokenId value]
    > HTTP Request#5
        - HttpHeader Manager [Passing UniqueTokenId value]

The above test plan I am saving unique Token value extracted in Regular Expression Extractor through JSR223 post script, this script contains only one sentence:

props.put("tokenID",vars.get("RgxUniqueToken"))

And this saved value Passed in HTTP Header Manager to all Successive Http requests.

This test plan works fine for single user as well as multiple users and shows 200 OK response. When I did QC of each request I found that jmeter is passing same tokenID value to all HTTP headers for each users (Thread) in multi user scenario. However the JSR223 post process get unique token value for each users. According my test plan it should pass unique value for each thread.

I do not understand what is wrong in my script. Can anyone have any other way to pass token id unique to each users (thread).

0

As per JMeter Functions and Variables documentation chapter:

Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.

So you extract the variable with 1 thread and update the value for all threads resulting in all virtual users use the same token.

Just remove this "JSR223 PostProcess" bit and use JMeter Variable instead of JMeter Property, JMeter variables are thread-local hence each user will have its own token.

With regards to "multiple users and shows 200 OK response", JMeter automatically considers HTTP Status Codes below 400 as successful, it doesn't do any other checks. If want to check response content as well, not only the status code - consider using Response Assertion.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.