我使用SOAPUI發送請求,並且需要在文本/ XML消息的末尾添加一個製表符/空格,以便服務器和我接受得到適當的迴應。我需要一個Groovy腳本,它將簡單地將一個選項卡添加到文本/ XML請求的末尾。謝謝Groovy腳本在文本/ XML請求結尾處添加一個選項卡SOAPUI
-2
A
回答
0
在評論中提到的方法是修復您的WS在請求結束時無需額外的選項卡/空間即可正常工作。
另一個簡單的選項,如果您不能修復de WS因爲它是第三方服務,那麼只需在testStep中手動添加一個選項卡作爲請求的一部分。因爲有些時候
Anywise是必要的或util的修改某些其他原因,我會告訴你如何得到SOAP請求有的Groovy腳本來操縱它的一個示例的請求。你可以這樣做增加了Groovy的一步步測試用下面的代碼:
// get the testStep by name
def testStep = testRunner.testCase.getTestStepByName('Your request name')
// get request content
def originalRequestContent = testStep.getPropertyValue('request')
// perform your modifications...
// in your case simply add a new tab
def newRequestContent = "${originalRequestContent}\t"
// as tab is not showed in the Raw tab of your testStep,
// to show that this code work as expected I add
// and unnecessary extra text
newRequestContent += 'it works'
// set the new modified request
testStep.setPropertyValue('request',newRequestContent)
// and finally you can send the request
testStep.run(testRunner,context)
// if you want to keep the step as orignal uncomment
// the follow line
// testStep.setPropertyValue('request',originalRequestContent)
希望它能幫助,
+0
非常感謝你!這是一個第三方服務,所以,可惜我無法修復實際的服務。 –
相關問題
- 1. 從SoapUI groovy腳本請求標題
- 2. SoapUI Groovy腳本
- 3. 在soapui groovy腳本中從xml中獲取文本值
- 4. SOAPUI Groovy - 在另一個測試用例中更新XML請求
- 5. 了SoapUI - 使用Groovy腳本
- 6. 腳本庫使用Groovy - SOAPUI
- 7. Charles請求「文本」選項卡
- 8. 在Shell腳本中添加一個選項卡
- 9. 用groovy更改SoapUI請求
- 10. 在groovy腳本中發送curl請求
- 11. Cassandra與Groovy腳本的連接在SoapUI
- 12. Groovy腳本在SoapUI中發生錯誤
- 13. SOAPUI和Groovy腳本,在一個執行多個SQL語句去
- 14. 使用GROOVY腳本將Cookie添加到SoapUI中的標頭
- 15. 重命名JPEGS的批處理腳本在結尾添加1
- 16. groovy/SoapUi從另一個腳本調用一個靜態函數
- 17. 如何將選項卡添加到一個文本文件
- 18. 在groovy腳本中創建一個SoapUI測試?
- 19. 如何使用Groovy腳本在SOAPUI中觸發REST請求測試步驟
- 20. android在文本結尾添加'...'_EDIT
- 21. 在一個AfterRender添加密新腳本不解僱XHR請求
- 22. 使用Groovy腳本讀取值的SoapUI
- 23. SOAPUI - Groovy腳本 - jsonBuilder帶引號
- 24. SOAPUI Groovy腳本調用命令行
- 25. SoapUI:從Groovy腳本構建DataSource屬性
- 26. 如何XML效應初探發送到Groovy腳本中了SoapUI
- 27. soapui - 將XML字符串分配給變量 - groovy腳本
- 28. SOAPUI Groovy腳本插入自定義值的xml節點
- 29. SoapUI如何通過Groovy腳本更新WSDL定義並重新創建請求
- 30. 在silverlight文本的開始和結尾處添加圖像
「我需要一個Groovy腳本,將只需要添加一個標籤到文本/ XML請求結束「。好。那麼爲什麼不寫一個呢? – rmlan
爲什麼您首先需要額外的選項卡/空間才能被服務器接受?相反,修復。 –