Unanswered question

how to use dynamic values for validation

Hi ,
can we use any dynamic value for validation
For eg: in my application thers a caseid and on clicking that caseid i get that ids detail, i want to use the name in that details for validation
but it changes with each case id
so how to put validation for such thing?

Divya K.
Divya K.

Divya K.

Level
1
230 / 750
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

Yes you can use a NeoLoad variable in your validation. The content of that variable will be replaced at runtime if the content is available.

Divya K.
Divya K.

Divya K.

Level
1
230 / 750
points

Hi ,
I have added that content , but the assertion failed
I have attached the file
I have captured the value in the request and placed in the validation tab.

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

I can see that you've configured two validations in your response. What was the content of the error when you run your check user or test?

Could you copy/paste the content here?

Divya K.
Divya K.

Divya K.

Level
1
230 / 750
points

I simply got
Assertion failed. The response does not contain the specified pattern: ${name}.

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

If your variable name has not been replaced then it means that this variable was unkown when NeoLoad tried to use it.

Have you created your variable extractor on a previous request or on the same where you have configured your validation?

Divya K.
Divya K.

Divya K.

Level
1
230 / 750
points

Yes i have created my variable extractor on same request where i have configured my validation

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

Ok so it explains why it does not work. You can't create and use your variable extractor on the same request. The variable does not exist yet when it is evaluated by the validation mechanism.

You have to create your variable extractor before that request.