SOAP UI - 在 CMD 执行中使用 -t 设置代理设置

SOAP UI - Set Proxy Settings Using -t in CMD Execution

关于这个主题的文档我一无所获。

到目前为止,我知道用于设置代理设置的执行命令是“-t”,但是,我无法真正设置代理设置。

换句话说,命令行查询如下所示:

"cmd /C CD  
C:\Program Files\SmartBear\SoapUI-5.2.1\bin & testrunner.bat 
-c""TestCase"" ""SOAP_QUERY.XML"" 
-S 
-P""UserName=UsernameTest"" 
-P""Password=PasswordTest"" 
-t""autoProxy_TrueOrFalse=False"" 
-t""activateProxy_TrueOrFalse=True"" 
-t""proxy_Host=ProxyAddress"" 
-t""proxy_Port=ProxyPort"" 
-t""proxy_Username=ProxyUsername"" 
-t""proxy_Username=ProxyPassword"" 
-P""OutPutDumpFileLocation=OutPut.XML"" 
-e ""https://EndPoint"" 
-r > ""ExecutionLog.Txt"

显然,我提供的值不是那些文本值 - 我将实际细节放在那里。例如,ProxyPort 可以是 8080。

我知道 XML 代理设置如下所示:

 <con:soapui-settings xmlns:con="http://eviware.com/soapui/config">
     <con:setting id="ProxySettings@autoProxy">XYZ</con:setting>
     <con:setting id="ProxySettings@enableProxy">XYZ</con:setting>
     <con:setting id="ProxySettings@host">XYZ</con:setting>
     <con:setting id="ProxySettings@port">XYZ</con:setting>
     <con:setting id="ProxySettings@username">XYZ</con:setting>
     <con:setting id="ProxySettings@password">XYZ</con:setting>
  </con:soapui-settings>

但是,我不知道这是进入查询还是直接进入设置文件,然后您可以像这样对其进行参数化:

<con:soapui-settings xmlns:con="http://eviware.com/soapui/config">
     <con:setting id="ProxySettings@autoProxy">${#Project#autoProxy_TrueOrFalse}</con:setting>
     <con:setting id="ProxySettings@enableProxy">${#Project#activateProxy_TrueOrFalse}</con:setting>
     <con:setting id="ProxySettings@host">${#Project#proxy_Host}</con:setting>
     <con:setting id="ProxySettings@port">${#Project#proxy_Port}</con:setting>
     <con:setting id="ProxySettings@username">${#Project#proxy_Username}</con:setting>
     <con:setting id="ProxySettings@password">${#Project#proxy_Password}</con:setting>
  </con:soapui-settings>

我什至尝试将命令行查询修改为:

"cmd /C CD  
C:\Program Files\SmartBear\SoapUI-5.2.1\bin & testrunner.bat 
-c""TestCase"" ""SOAP_QUERY.XML"" 
-S 
-P""UserName=UsernameTest"" 
-P""Password=PasswordTest"" 
-t""ProxySettings@autoProxy=False""
-t""ProxySettings@enableProxy=True""
-t""ProxySettings@host=ProxyAddress""
-t""ProxySettings@port=ProxyPort""
-t""ProxySettings@username=ProxyUsername""
-t""ProxySettings@password=ProxyPassword"" 
-P""OutPutDumpFileLocation=OutPut.XML""
-e ""https://EndPoint"" 
-r > ""ExecutionLog.Txt"

如果有人有创建此命令行执行的经验,请帮助我。

您可以像这样使用 Groovy 以编程方式执行此操作:

    import com.eviware.soapui.SoapUI
    import com.eviware.soapui.settings.ProxySettings

    SoapUI.settings.setString(ProxySettings.HOST, proxyServer)
    SoapUI.settings.setString(ProxySettings.PORT, proxyPort)
    SoapUI.settings.setString(ProxySettings.USERNAME, proxyUser)
    SoapUI.settings.setString(ProxySettings.PASSWORD, proxyPwd)
    SoapUI.settings.setString(ProxySettings.ENABLE_PROXY, "true")
    SoapUI.saveSettings()
    SoapUI.updateProxyFromSettings()