In Jmeter How can I use a captured regex variable as part of a file name? -


i'm having difficulty using variable containing regex capture part of file name in 'save response file' listener. able use captured variable in if controller successfully. not happy when use in file prefix section of 'save response file' listener.

this json performing regex on

"command":"archive_file" 

this regex

reference name:     command regular expression: "command":"(.+?)" template:           $1$ match no.           1 default value:      command_not_found 

i can use captured variable in 'if controller'. although must admit, bit confused required double quotes. (i have tried without double quotes if condition not trigger)

if controller condition:     "${command}"=="archive_file" 

so said, have validated above works. when try use captured variable part of file name prefix in 'save response file', saves file literally '${command}'. not value stored in variable.

filename prefix: d:\tmp\${command} 

suspecting issue has quotes, tried experiment.

filename prefix: d:\tmp\"${command}" 

this did give me value captured in variable, book-ended in double quotes , jmeter not @ happy that.

jmeter.reporters.resultsaver: error creating sample file client download start java.io.filenotfoundexception: d:\apache-jmeter-2.9\tmp\client\"archive_file" (the filename, directory name, or volume label syntax incorrect)

any appreciated here.

you can either:

1. double back-slashes in filename prefix field:

d:\\tmp\\${command} 

because single backslash in case taken 'escape' character , variable not expanded value;

or:

2. define d:\tmp\ part elsewhere in script separate variable e.g. ${responsepath} , replace d:\tmp\ in filename prefix field variable:

${responsepath}${command} 

both variants work correctly 2nd 1 seems bit more general.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -