2016-04-25 13 views
0

- 是否有任何方式從外部文件或其他東西傳遞全局屬性? - 我不想導航首選項 - 全局屬性並更改值。 - 有沒有其他方法可以做到這一點。有沒有辦法從外部文件或其他東西傳遞全局屬性?

感謝, Arivazhagan

+1

有這:https://www.soapui.org/scripting---properties/working-with-properties.html#2-Setting-properties-from-the-command-line – SiKing

+0

當你嘗試@SiKing建議的時候發生了什麼? – Rao

回答

0

可以在Groovy腳本步驟解析外部文件,例如* .CSV與值文件到本地常規變量,然後在測試套件的性能或測試案例或全局設定值屬性也是。

解析的示例* .csv文件:

def testDataSet = [] 
def index = testRunner.testCase.getPropertyValue("index") 
int indx = index.toInteger() 
def fileName = "phoneNumbers.csv" 
//read from file 
new File(fileName).eachLine { line -> testDataSet.add(line.split(";")) } 
log.info("Read " + testDataSet.size() + " test values from " + fileName) 
//convert value to properties 
def testDataLine = testDataSet[indx] 
phoneNumber = testDataLine[0].value as String 
log.info phoneNumber 

一套屬性例:設置全局Preporty的

testRunner.testCase.setPropertyValue("phoneNumber", phoneNumber) 
indx++ 
String indexString = Integer.toString(indx) 
testRunner.testCase.setPropertyValue("index", indexString) 

例子:

globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("MyProp") 

更多的信息在這裏提供https://www.soapui.org/scripting-properties/tips-tricks.html

相關問題