2017-08-01 76 views
1

我正在调试jenkins + ant + jmeter框架,在双引号(“”)可以使用双引号(“xxx”)到双引号不会显示,变成xxx,我看到build.xml和debug发现有可能是蚂蚁对jmeter进程有问题?见下面如何在蚂蚁属性(“”)中保留引号?

下面的参数是引号( “MallID”) enter image description here

enter image description hereenter image description here

<target name="run" depends="clean, show-test-properties"> 
 
\t \t 
 
\t \t <!-- create dir --> 
 
\t \t <mkdir dir="${test.result.path}"/> 
 
\t \t <mkdir dir="${test.log.path}"/> 
 
\t \t 
 
\t \t <jmeter 
 
\t \t \t jmeterhome="${jmeter.home}" 
 
\t \t  testplan ="${test.plan.path}" 
 
\t \t  resultlog="${test.result.path}/result.jtl" 
 
\t \t \t jmeterlogfile="${test.log.path}/jmeter.log" 
 
\t \t \t > 
 
\t \t \t <jvmarg value="${jvm.arg}"/> <!-- modify as you wish --> 
 
\t \t \t 
 
\t \t \t <!-- Force suitable defaults --> 
 
\t \t \t <!-- values for UDV --> 
 
\t \t \t <property name="api.url" value="${api.url}"/> 
 
\t \t \t <property name="api.fieldparam" value="${api.fieldparam}"/> 
 
\t \t \t <property name="api.bodyparam" value="${api.bodyparam}"/> 
 

 
\t \t </jmeter> 
 
\t </target>

enter image description here

这里所有的引号(“”)标志被取消(MallID)为什么? enter image description here

+0

我想保持报价在ant属性(“”) – blue

+0

这不是蚂蚁的限制,但实际上一般限制* Java的*处理命令行系统属性。您可以在属性文件或脚本中设置包含引号的属性,但据我所知,不可能通过命令行发送引号,因为Java将始终删除它们。 – CAustin

回答

1

在Ant中设置任何内容时,需要使用双引号(即“”)来指定值。如果你想保持报价的价值,我会建议您尝试以下操作:

<property name="api.url" value="&quot;${api.url}&quot;"/> 
<property name="api.fieldparam" value="&quot;${api.fieldparam}&quot;"/> 
<property name="api.bodyparam" value="&quot;${api.bodyparam}&quot;"/> 
+0

非常感谢你,解决我的问题! :) @ calvin.lau – blue

+0

@blue没问题。我建议指的是说明在未来所有的XML特殊字符的情况下,一个图表,你发现自己在一个类似的情况: '<\t < > \t > “\t " &\t & ”\t '' –

+0

谢谢“[{”assert“:”m“,”fieldname“:”v“,”max“:0,”min“:0},{”assert“:”g “,”fieldname“:”c“,”max“:0,”min“:0}]”并使用ant参数“”例如:“”但仍没有保持双倍引号“”,不知道为什么?@calvin.lau – blue