2

I have a test plan with a csv data set config set up like so: CSV Data set Config

My csv file looks likes: CSV file

My JSR223 Assertions looks like: JSR223 Assertion

I want to use those values in D-J for my assetions. I tried using vars.get("phmDownloadStatus") and ${phmDownloadStatus} inside of the groovy script but neither gets the value from the file. How do i go about using these values?

3 Answers 3

1

You have to specify the variable names inside your csv data set config. Add the variable names for each column in your csv file separated by a comma delimiter as below

enter image description here

Make sure to select ture for ignore first line as well if you are using headers.

Now you should be able to use these values in your JSR223 Assertion.

Sign up to request clarification or add additional context in comments.

Comments

0
  1. To get variables from a CSV file first of all you need to create a CSV file configuration tab using Jmeter UI.
  2. Then provide the source path of the SCV file and provide the names for variables as you want.

enter image description here

  1. When you are done with the configurations window should be something similar to this. Then specify a delimiter to separate the data points for variables.
  2. Then create a CSV file that aligns properly with the configurations you have defined. (Example set of data in the CSV according to the attached config is provided here)
/t/3wso2.com/customers_3_1/1.0.0,3wso2.com,rkheSO1QK8DWLXKfYUJFrqXtHvAa,3bNiqxKVMAtpg9zdbcZQODP6qK4a
/t/3wso2.com/customers_3_1/1.0.0,3wso2.com,f6inOQocRxm2qTmAkG3z9dNboOMa,CVsZlaVlg0WVlyqHc97bHQ6WCOca
/t/3wso2.com/customers_3_1/1.0.0,3wso2.com,ZYJW0i02wSuyqlGB3WPWSvZGHYca,_cJLdQaeTo0j9gci5S2ELvaT_Yca

Comments

0

Your approach looks okayish, just make sure that your J_phmDownloadStatus and phmDownloadStatus JMeter Variables exist and have their respective anticipated values, you can check which variables are available for JMeter using Debug Sampler and View Results Tree listener combination

Just make sure:

  1. To declare variable names which will be 100% matching the column names in your CSV file including case of every single letter because foo and Foo are absolutely different beasts from JMeter Variables perspective
  2. Don't refer JMeter Variables in Groovy scripts as ${phmDownloadStatus} as JSR223 sampler will cache the first occurrence and will use it for all subsequent iterations

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.