2
votes

I have a test plan in JMeter that has a Response Assertion where I'd like to use a variable that comes from a CSV Data Set Config. So my Pattern looks like:

${assert1}

Which corresponds (at least in my thoughts) to what comes from the file used in CSV Data Set Config, but it doesn't work. I have seen multiple suggestions to use a Regular Expression Extractor, but the examples I saw refer to something they're trying to capture from a page. In my case I am using an external csv file.

My question: how can I use a variable as input for a Response Assertion pattern ?

2
Can you show screenshots of your CSV config, and Response Assertion content ? - UBIK LOAD PACK
Thanks for letting me look into my config! I had used semi colon instead of comma-delimited. Stupid thing is, that I already had seen that I told myself don't forget that! But ok, thanks alot! - Jonathan Ramos

2 Answers

0
votes

I have successfully used a CSV Data Set Config as a source of string that I use in a url parameter, and then use a Response Assertion to seek out that parameter in the response.

  • Variable name: P.
  • URL: /product/${P}.
  • The response assertion Parterns to Test: ${P}.

I wonder if it is not necessary to use the CSV data variable in the request in order for it to be available in the response assertion?

0
votes

If my understanding is right,
here your problem:
You want to use the value from your CSV as part of URL and that too via variable.

Solution:

Configure your CSV Data Set Config like this:

  • Filename: url csv path
  • variable name : assert1
  • Delimiter : , (if your CSV comma separated)
  • leave remaining unchanged

That's it you can use the variable assert1 anywhere: ${assert1}.