简体   繁体   English

在jmeter中使用转义字符时的Java强制文字

[英]java force literal when using escape character in jmeter

Running Jmeter on XP, I have the following scenario: 在XP上运行Jmeter,我有以下情形:

Declare the variable "ServerName" with the value 'serverNameValue'
Declare the a variable "TestResultsFolder" with the value 'c:\results\${ServerName}'
... do samplers ...
Have a simple data writer save result to "${TestResultsFolder}\file"

Unfortunately, The data writer is saving to ' c:\\results\\${ServerName} ' instead of ' c:\\results\\serverNameValue ' 不幸的是,数据写入器保存到' c:\\ results \\ $ {ServerName} '而不是' c:\\ results \\ serverNameValue '

if I put a valid alpha character before the variable, it works: ' c:\\results_${ServerName} ' yields ' c:\\results_serverNameValue ' 如果我在变量前放置一个有效的字母字符,它将起作用:' c:\\ results _ $ {ServerName} '产生' c:\\ results_serverNameValue '

Thus, it seems that the \\ is escaping the variable declaration of $, causing the program NOT to supply the correct value. 因此,似乎\\正在转义$的变量声明,导致程序未提供正确的值。

Any thoughts on how I might actually obtain c:\\results\\serverNameValue 关于如何实际获取c:\\ results \\ serverNameValue的任何想法

Does the '\\' character have to be escaped, in order to explicit that you need a real '\\', and not an escape of the next character? 是否必须转义'\\'字符以明确表明您需要一个真实的'\\',而不是下一个字符的转义?

I would try this : " c:\\\\results\\\\${ServerName} " 我会尝试:“ c:\\\\ results \\\\ $ {ServerName}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM