我尝试按顺序执行多个Post API,它使用Groovy脚本放置在Soap UI的Excel Sheet中。我正在分享Excel请查看。
此致 Anusha。
S.NO方法URL STATUS RES_TIME TIME_STAMP JSON_Input 1 POST Example.json 2 POST Example1.json 3 POST Example2.json 4 POST Example3.json 5 POST Example4.json 6 POST Example5.json 7 POST Example6.json Example7.json
答案 0 :(得分:0)
您可以尝试以下代码:
import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
def reqOperationName = ""
def inputDataFileName = "D:/sample/temp1.xls"
def inputDataSheetName = "Sheet1"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet sheet1 = workbook.getSheet(inputDataSheetName)
try{
rowcount = sheet1.getRows()
colcount = sheet1.getColumns()
for(Row in 1..rowcount-1){
reqOperationName = sheet1.getCell(1,Row).getContents()
log.info reqOperationName
//test the request
testRunner.runTestStepByName(reqOperationName)
}
}
catch (Exception e) {log.info(e)}
finally{
workbook.close()
}
这应该适合您的要求。如果有帮助,请告诉我。