起初,我已经把几个问题Excel工作表的响应。这与我的要求的提高有关。我试图在Excel表格中保存响应。然而,答复正在写两次。请帮助我,我滞后,以防止重复记录写作。如何写现有使用Groovy脚本
import jxl.*
import jxl.write.*
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder("Step2#Response")
def request=groovyUtils.getXmlHolder("Step2#Request")
File fr = new File("C:\\Users\\Documents\\Groovy Scripts\\response\\output.xls")
Workbook wk = Workbook.getWorkbook(fr);
WritableWorkbook wr = Workbook.createWorkbook(fr, wk);
WritableSheet sheet= wr.getSheet(0);
def r = sheet.getRows();
log.info "rows: ${r}"
xPath1 = "//*:description/text()"
xPath2 = "//*:OrderId/text()"
xPath3 = "//*:m/text()"
Label orderid = new Label(0,r ,request.getNodeValue(xPath2));
sheet.addCell(orderid);
Label mode = new Label(1,r ,request.getNodeValue(xPath3));
sheet.addCell(m);
Label description = new Label(2,r , holder.getNodeValue(xPath1));
sheet.addCell(description);
Label response = new Label(3, r, context.expand('${Step2#Response}'));
sheet.addCell(response);
wr.write();
wr.close();
链接到先前的帖子:Groovy script to Read an xml file and update next step request with file contents
可有人恳请帮助我如何 – user3212324
你加入这行代码来解决重复的问题。但不清楚你到底想要达到什么目标,什么是问题? – Rao
@Rao,请在屏幕截图中找到记录在表单中写入两次。每条记录重复两次。上面的代码写在步骤2 – user3212324