2017-08-01 66 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