Forum Discussion

JT7's avatar
JT7
Occasional Contributor
5 years ago

The Burp - Last Test Step Runs Twice when running at the Test Case Level (SOAP)

I'm might be doing something wrong, but when I run my Test Cases (it's data-driven), after the last step (Step [ReadData] ran with status [OK], it runs the last Test Step again.

 

When I run just the Groovy code portion, it's reading the correct # of times (see attachment).  Here I've added a couple of log info stmts to show this.

 

I don't have any Setup or Teardown scripts - just the Groovy code and the Request/Response.  And yes, the spreadsheet has 6 rows of data and all the input values are different.  I have a variable in the SOAP Request and use Assertions - but I just disabled the assertions and it still "burped."

 

Here is my Groovy code:

import jxl.*
import jxl.write.*
import com.eviware.soapui.support.XmlHolder
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
Workbook workbook = Workbook.getWorkbook(new File("c:\\SoapUIData\\Fahrenheit-Temps.xls"))
//The writeable sheet will erase any data, so we can't use the data sheet and update it with the results
WritableWorkbook copy = Workbook.createWorkbook(new File("c:\\SoapUIData\\Fahrenheit-Chart.xls"), workbook);
WritableSheet sheet1 = copy.createSheet("Fahrenheit to Celsius", 0)
Sheet sheet = workbook.getSheet(0)
def rowCount = sheet.getRows()

for (r=1; r<rowCount; r++){ //r=1 skip header row
log.info "Line 13"
//Write columns headings
Label H1 = new Label(0, 0, "Fahrenheit Value Submitted"); //1st column heading
sheet1.addCell(H1);
Label H2 = new Label(1, 0, "Expected Result"); //1st column heading
sheet1.addCell(H2);
Label H3 = new Label(2, 0, "Actual Result"); //1st column heading
sheet1.addCell(H3);

//Read a Fahrentheit temp
valCellContents=sheet.getCell(0,r)
cellContents=valCellContents.getContents()
FAHRENHEIT = cellContents.toString()
testRunner.testCase.setPropertyValue("Fahrenheit",FAHRENHEIT)
Label fh = new Label(0, r, FAHRENHEIT); //1st column
sheet1.addCell(fh);


// Below I'm going to use the properties to perform assertions
valCellContents=sheet.getCell(1,r)
cellContents=valCellContents.getContents()
EXPECTEDRESULT = cellContents.toString()
testRunner.testCase.setPropertyValue("EXPECTEDRESULT",EXPECTEDRESULT)
Label expectedResult = new Label(1, r, EXPECTEDRESULT);
sheet1.addCell(expectedResult);

testRunner.runTestStepByName("FahrenheitToCelsius-Request")

//Get Celsius temp fromCelsiusValue Response
def res = context.expand('${FahrenheitToCelsius-Request#response}')
def response = new XmlHolder(res)
def CelsiusValue = response.getNodeValue('//m:FahrenheitToCelsiusResult')

//Write the actual result in 3rd column
Label label = new Label(2, r, CelsiusValue); //3rd column
sheet1.addCell(label);

} //Gets next row
log.info "Line 51"
copy.write();
copy.close();
workbook.close()

 

Here is the Soap Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://webservices.daehosting.com/temperature">
<soapenv:Header/>
<soapenv:Body>
<tem:FahrenheitToCelsius>
<tem:nFahrenheit>${#TestCase#Fahrenheit}</tem:nFahrenheit>
</tem:FahrenheitToCelsius>
</soapenv:Body>
</soapenv:Envelope>

 

Thanks in advance.

No RepliesBe the first to reply