문제

I have four variables:

url

uuid

affiliate_type

custom_url

Example of line from csv(\t delimited)

1) http://home.com/home123:F7zBnMyn0Lo shomei 3 http://home.net

2) http://home2.com/defjkl456 sshomei 4

Requests:

1.) POST data: url=http%3A%2F%2Fhome.com%2Fhome123%3AF7zBnMyn0Lo+&uuid=sshomei&affiliate_type=3&custom_url=http%3A%2F%2Fhome

2.) POST data: url=http%3A%2F%2Fhome2.com%2Fdefjkl456&uuid=sshomei&affiliate_type=4&custom_url=

My main question is, is there a simple way to remove &custom_url= entirely if no value exists? I have massive files with millions of requests that I need to test. I would prefer not to break up the files based off how many variables they have.

Thank you for your time,

John

도움이 되었습니까?

해결책

You can construct you url the next way: http%3A%2F%2Fhome.com%2Fhome123%3AF7zBnMyn0Lo+&uuid=sshomei&affiliate_type=3${CUSTOM_URL} where CUSTOM URL is user defined variable. In PreProcessor you can compare whether custom url read from file equals empty string

if(targetString.equals(''))
{
   vars.putObject("CUSTOM_URL",'');
}
else 
{
   vars.putObject("CUSTOM_URL",valueReadFromCSV.toString());
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top