-Is there any way to pass Global Properties from external file or something? -I don't want to navigate Preference-Global Properties and changing the values. -Is there any alternative way to do this.
Thanks, Arivazhagan
答案 0 :(得分:0)
您可以在groovy脚本中解析外部文件Step,例如* .csv文件,其值包含在本地groovy变量中,然后在Test Suite或Test Case或Global Properties的Properties中设置值。
解析* .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
set属性的示例:
testRunner.testCase.setPropertyValue("phoneNumber", phoneNumber)
indx++
String indexString = Integer.toString(indx)
testRunner.testCase.setPropertyValue("index", indexString)
设置Global Preporty的示例:
globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "MyProp" )
此处提供了更多信息https://www.soapui.org/scripting-properties/tips-tricks.html
答案 1 :(得分:0)
全局属性存储在user.dir的soapui-settings.xml中。如果更改它,它将被readyApi / soapUI识别。