我在SoapUI中有一個Groovy腳本,用於每個TestStep記錄天氣的步驟已通過或失敗。我希望Groovy腳本記錄出錯的斷言信息。SoapUI Groovy Script,log.info有關測試步驟運行的詳細信息。
import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
def TestCase = testRunner.getTestCase()
def StepList = TestCase.getTestStepList()
StepList.each{
// check that testStep has assertionStatus
// (for example groovy testSteps hasn't this property since
// there is no asserts on its)
if(it.metaClass.hasProperty(it,'assertionStatus')){
if(it.assertionStatus == AssertionStatus.FAILED){
log.info "${it.name} FAILED"
}else if(it.assertionStatus == AssertionStatus.VALID){
log.info "${it.name} Passed"
}else if(it.assertionStatus == AssertionStatus.UNKNOWN){
log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)"
}
}
}
目前,我得到這樣的輸出:
Thu Oct 20 11:31:06 BST 2016:INFO:TestStep_0051 Passed
Thu Oct 20 11:31:06 BST 2016:INFO:TestStep_0052 FAILED
Thu Oct 20 11:31:06 BST 2016:INFO:TestStep_0053 Passed
我想失敗的斷言爲什麼它更多的細節無法顯示該消息。它的失敗步步測試本身我得到的消息:
assert node.toString().matches("(0|175.238|0)\\d*") | | | | | false | 132.497286826667 132.497286826667
此外,當我運行這個Groovy腳本,會彈出一個窗口,其標題爲「信息」,這只是有一個黑色的背景和如此廣泛我似乎無法找到它的右側。有人知道這是什麼嗎?
令人驚歎的謝謝 – Ross
@羅斯很高興幫助你':)' – albciff