我正在使用Beanshell预处理器,我需要将值替换为我的“String”来分配参数值(JSON格式),我有这个
String textToSign =
"{ \"origin\": \"${origin_encrypted}\"," +
" \"destiny\": \"${destiny_encrypted}\"," +
" \"subject\": \"${subject_encrypted}\"," +
" \"amount\": \"${amount_encrypted}\"," +
" \"softToken\": \"${softToken_encrypted}\" }";
log.info("Text To Sign: " + textToSign);
字符串
但是我得到了Text To Sign: { "origin": "${origin_encrypted}", "destiny": "${destiny_encrypted}", "subject": "${subject_encrypted}", "amount": "${amount_encrypted}", "softToken": "${softToken_encrypted}" }
,请帮助我:(
1条答案
按热度按时间rm5edbpk1#
首先,您应该重新考虑使用Beanshell,因为JMeter 3.1建议使用JSR223 Test Elements和Groovy语言进行脚本编写。
Groovy还提供more handy way to build JSON而不是字符串连接。
字符串
关于JMeter中Groovy脚本的更多信息:Apache Groovy: What Is Groovy Used For?