tag:blogger.com,1999:blog-3806208351698608392.post314210631306866613..comments2023-10-28T16:37:34.195+05:30Comments on Software Testing Space: SoapUI Data Driven Testing GroovyInder P Singhhttp://www.blogger.com/profile/05923580987480854491noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-3806208351698608392.post-66355089283351082702022-11-05T20:13:55.500+05:302022-11-05T20:13:55.500+05:30I am getting the same error. Anyone figuered this ...I am getting the same error. Anyone figuered this out yet? Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-87641376905700240432021-04-17T18:18:10.766+05:302021-04-17T18:18:10.766+05:30Hello, your Groovy script is a data-driven testing...Hello, your Groovy script is a data-driven testing script but different from my script above. I don't see any data loop in your script. Best wishes, InderInder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-73296353411014441332021-04-12T18:10:34.074+05:302021-04-12T18:10:34.074+05:30Hello Inder,
I am using free soap-ui version . fo...Hello Inder,<br /><br />I am using free soap-ui version . for basic project (Calculator WSDL). for that i want to save soapui response values to excel, I have written groovy script for that like shown below , am passing multi data in request but in excel its saving last response only , i want to get all response values. can any one please help me.<br /><br />import jxl.*<br />import jxl.write.*<br /><br />def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )<br />def holder = groovyUtils.getXmlHolder("Add#Response") <br /><br />log.info holder.getXml() <br /><br />WritableWorkbook workbook = Workbook.createWorkbook(new File("F:\\Usersdata\\output4.xls"))<br />WritableSheet sheet = workbook.createSheet("Worksheet 1", 0)<br /><br />log.info(sheet.isHidden())<br /><br />xPath1 = "//*:AddResult/text()" <br /><br />log.info holder.getNodeValue(xPath1)<br /><br /><br />Label label = new Label(0, 1, holder.getNodeValue(xPath1)); <br />sheet.addCell(label);<br /><br /><br /><br />workbook.write();<br />workbook.close();Anonymoushttps://www.blogger.com/profile/10314527793811478966noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-10650064748271735042021-03-11T04:16:46.985+05:302021-03-11T04:16:46.985+05:30Hi Inder, above code works perfectly and very usef...Hi Inder, above code works perfectly and very useful. Can u also provide code for writing the xml response to the same excel sheet from where data is read please? Anonymoushttps://www.blogger.com/profile/04196962908312007985noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-18068717236469772272021-02-23T14:35:09.764+05:302021-02-23T14:35:09.764+05:30Hi, how do you know me? You should use the XSSF of...Hi, how do you know me? You should use the XSSF of Apache POI to handle .xlsx format.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-47271659772413832282021-02-23T07:05:48.854+05:302021-02-23T07:05:48.854+05:30Hi Inder, Can you please provide some steps on how...Hi Inder, Can you please provide some steps on how to handle .xlsx format using Apache POI?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-25165094502947239812020-12-28T21:30:41.021+05:302020-12-28T21:30:41.021+05:30You should check the line number where you get thi...You should check the line number where you get this error. But, first view the demonstration of the code in SoapUI in my SoapUI Data Driven Testing Groovy Tutorial at https://youtu.be/MndDpJvzmy4Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-52275069049391659112020-12-28T20:23:32.167+05:302020-12-28T20:23:32.167+05:30Good day say. Im new in soapui. ive try yourcode s...Good day say. Im new in soapui. ive try yourcode somehow the error appear they cant read ToInteger with "java numberformatexception error" can you advice how can this error be solved? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-29428958225823755602020-10-15T23:35:10.584+05:302020-10-15T23:35:10.584+05:30Hi Vignesh,
Thank you for your support to my blog...Hi Vignesh,<br /><br />Thank you for your support to my blog and videos in Software and Testing Training channel. <br />You should check the line number where you get the Java ArrayIndexOutOfBoundsException in the script log. Also, you need to run the Groovy Script - CleanUp before running the Groovy Script, every time.<br /><br />InderInder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-89600918034246437722020-10-15T18:36:58.464+05:302020-10-15T18:36:58.464+05:30Hi Inder,
Your blog and videos was very helpful in...Hi Inder,<br />Your blog and videos was very helpful in the tough times.<br />I have tried using the same code and customized according to the need. Below getting the below error <br />"java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3" <br /><br /> Can you pls let me know in which part of code to be modified to resolve this issue.<br /><br />ThanksVigneshhttps://www.blogger.com/profile/04724361803070043950noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-65549497262484163162020-10-01T14:41:30.585+05:302020-10-01T14:41:30.585+05:30@NP - You are very welcome. I think that your appr...@NP - You are very welcome. I think that your approach is the correct way to generate HTML report. If you want a better report, you can transform the XML. Or you may want to use ReadyAPI. Thanks.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-35168348669538570532020-09-30T17:58:27.222+05:302020-09-30T17:58:27.222+05:30Truly Thanks again and much appreciated @Inder P S...Truly Thanks again and much appreciated @Inder P Singh<br />I am able to fetch data from excelsheet with test case name. <br />Could you please to help post - How can we generate a good html report from SOAP UI free version. Currently I'm using Apache Ant to run and generate html report(junit no frame report) . Report looks OK. But in the report, there is no no graphs, no iteration details and many more are missing.Thanks in advance NPhttps://www.blogger.com/profile/07430514879830598519noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-4390878672783572722020-09-27T18:13:49.606+05:302020-09-27T18:13:49.606+05:30Thank you so much🙏. I will try. Thank you so much🙏. I will try. NPhttps://www.blogger.com/profile/07430514879830598519noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-5296792197016048882020-09-27T11:17:41.797+05:302020-09-27T11:17:41.797+05:30Hi @NP. Thank you for your recommendation. Regardi...Hi @NP. Thank you for your recommendation. Regarding your query, you can try the same getSheet method with Excel sheet name e.g. Sheet Sheet1 = WorkBook1.getSheet("Sheet1"). Further, you could try to get all the Excel sheet names with WorkBook1.getSheetNames() in a string array.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-57148618017196405162020-09-26T17:54:34.101+05:302020-09-26T17:54:34.101+05:30Thank you so much @Inder P Singh
This blog is very...Thank you so much @Inder P Singh<br />This blog is very helpful.Thanks for your effort and excellent work.<br />Would like to ask you one query here that, in my project there are n number of test cases are there. So I want to fetch data from excel sheet by Sheet name not by index.So could you please help, how can we read the excel file by excel sheet name(e.g TestCase-1,TestCase-2 etc.)?NPhttps://www.blogger.com/profile/07430514879830598519noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-82066177794597799852020-08-11T10:43:33.917+05:302020-08-11T10:43:33.917+05:30hi,
Thanks for explainating very well.I am getting...hi,<br />Thanks for explainating very well.I am getting this error. can you please help me out?<br />org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script20.groovy: 5: unable to resolve class Workbook @ line 5, column 10. Workbook WorkBook1 = Workbook.getWorkbook(new File("C:\\repo\\Book1.xls")) ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class Workbook @ line 5, column 10. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:150) at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:326) at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:336) at org.codehaus.groovy.control.ResolveVisitor.transformVariableExpression(ResolveVisitor.java:1026) at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:758) at org.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression(ResolveVisitor.java:1165) at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:762) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:144) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42) at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166) at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1402) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:55) at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:239) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1081) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1345) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:214) at org.codehaus.groovy.control.CompilationUnit$12.call(CompilationUnit.java:684) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:966) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:626) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:575) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293) at Pallavi Guptahttps://www.blogger.com/profile/10115317695863435593noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-38925925924578492392020-07-27T12:03:50.872+05:302020-07-27T12:03:50.872+05:30Hi. No, JExcelApi supports only xls format. If you...Hi. No, JExcelApi supports only xls format. If you cannot save your test data to xls format, you can try Apache POI for xlsx format support.<br /><br />Thanks,<br />InderInder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-28255289333769246942020-07-27T00:13:08.668+05:302020-07-27T00:13:08.668+05:30Hi..This code supports xlsx format?Hi..This code supports xlsx format?Anonymoushttps://www.blogger.com/profile/02572001563867380478noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-11089176374071093262020-06-05T11:13:24.593+05:302020-06-05T11:13:24.593+05:30It is not exactly the same code, because my code h...It is not exactly the same code, because my code had no RowCount variable. You should debug your written code and your Excel file. Looking at your script log, it seems that your code is running the DataLoop two times for 6 rows. After running the Groovy Script, did you get the Total property correctly as 17? Remember that you need to run the Groovy Script - CleanUp before running the Groovy Script, every time.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-17630779102214108512020-06-03T23:59:38.617+05:302020-06-03T23:59:38.617+05:30Tried on the said code, but it fails processing po...Tried on the said code, but it fails processing post 7 rows, allthough the input excel may had 17 rows.[rowcount captured.]<br /><br />Wed Jun 03 23:45:21 IST 2020:INFO:Loopcount0<br />Wed Jun 03 23:45:21 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:21 IST 2020:INFO:Row Count is 1 Number : A2 Word : B2 URL is : C2<br />Wed Jun 03 23:45:21 IST 2020:INFO:Loopcount1<br />Wed Jun 03 23:45:21 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:21 IST 2020:INFO:Row Count is 2 Number : A3 Word : B3 URL is : C3<br />Wed Jun 03 23:45:21 IST 2020:INFO:Loopcount2<br />Wed Jun 03 23:45:21 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:21 IST 2020:INFO:Row Count is 3 Number : A4 Word : B4 URL is : C4<br />Wed Jun 03 23:45:22 IST 2020:INFO:Loopcount3<br />Wed Jun 03 23:45:22 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:22 IST 2020:INFO:Row Count is 4 Number : A5 Word : B5 URL is : C5<br />Wed Jun 03 23:45:22 IST 2020:INFO:Loopcount4<br />Wed Jun 03 23:45:22 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:22 IST 2020:INFO:Row Count is 5 Number : A6 Word : B6 URL is : C6<br />Wed Jun 03 23:45:22 IST 2020:INFO:Loopcount5<br />Wed Jun 03 23:45:22 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:45:22 IST 2020:INFO:Row Count is 6 Number : A7 Word : B7 URL is : C7<br />Wed Jun 03 23:45:22 IST 2020:INFO:Exit Groovy Script - DataLoop<br />Wed Jun 03 23:47:07 IST 2020:INFO:Loopcount0<br />Wed Jun 03 23:47:07 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:07 IST 2020:INFO:Row Count is 1 Number : A2 Word : B2 URL is : C2<br />Wed Jun 03 23:47:07 IST 2020:INFO:Loopcount1<br />Wed Jun 03 23:47:07 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:07 IST 2020:INFO:Row Count is 2 Number : A3 Word : B3 URL is : C3<br />Wed Jun 03 23:47:08 IST 2020:INFO:Loopcount2<br />Wed Jun 03 23:47:08 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:08 IST 2020:INFO:Row Count is 3 Number : A4 Word : B4 URL is : C4<br />Wed Jun 03 23:47:08 IST 2020:INFO:Loopcount3<br />Wed Jun 03 23:47:08 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:08 IST 2020:INFO:Row Count is 4 Number : A5 Word : B5 URL is : C5<br />Wed Jun 03 23:47:08 IST 2020:INFO:Loopcount4<br />Wed Jun 03 23:47:08 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:08 IST 2020:INFO:Row Count is 5 Number : A6 Word : B6 URL is : C6<br />Wed Jun 03 23:47:08 IST 2020:INFO:Loopcount5<br />Wed Jun 03 23:47:08 IST 2020:INFO:RowCount:17<br />Wed Jun 03 23:47:08 IST 2020:INFO:Row Count is 6 Number : A7 Word : B7 URL is : C7<br />Wed Jun 03 23:47:08 IST 2020:INFO:Exit Groovy Script - DataLoop..charleshttps://www.blogger.com/profile/00223795875860799892noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-82484321050292235452020-05-22T10:04:30.568+05:302020-05-22T10:04:30.568+05:30Hi, you should check the line number where you get...Hi, you should check the line number where you get the java.io.filenotfound exception. Do you have an xls file? Have you given Excel file location with full and correct file path?Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-66510240870833424842020-05-20T11:47:20.241+05:302020-05-20T11:47:20.241+05:30Hi,
I am using the code above in the blog. But ge...Hi,<br /><br />I am using the code above in the blog. But get java.io.filenotfound exception.The system cannot find the file at specified location.<br />Can you plse adviseAnonymoushttps://www.blogger.com/profile/12791778088922877481noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-54468068173081658232020-02-29T23:33:17.932+05:302020-02-29T23:33:17.932+05:30"The problem I am facing is every time i am c..."The problem I am facing is every time i am creating new worksheet for each response. " Note that in my script, 1) I used Workbook.getWorkbook(new File(FilePath)) instead of Workbook.createWorkbook(new File("c:\\Users\\Desktop\\TD_Write_SoapUI.xls"))<br />2) I used WorkBook1.getSheet(0) instead of workbook.createSheet("Worksheet 1", 0) in your script.<br />Basically, I used an existing Excel workbook with an existing worksheet unlike your script which creates a new Excel file and a new worksheet every time. Hope this helps.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-80851875918604986852020-02-29T23:12:54.201+05:302020-02-29T23:12:54.201+05:30I am able to fetch and write response into excel s...I am able to fetch and write response into excel sheet but i want to write every response in excel sheet.how to do this.<br />Below code i am using<br />import groovy.json.JsonSlurper<br />import jxl.*<br />import jxl.write.*<br />json_s = new JsonSlurper()<br />response = context.expand('${CreateEmployee#Response}')<br />log.info response<br />json_response=json_s.parseText(response)<br />log.info json_response<br />def age = String.valueOf(json_response.data.age).replaceAll("[\\[\\](){}]","")<br />log.info age<br />def id = String.valueOf(json_response.data.id).replaceAll("[\\[\\](){}]","")<br />log.info id<br />def name = String.valueOf(json_response.data.name).replaceAll("[\\[\\](){}]","")<br />log.info name<br />def salary = String.valueOf(json_response.data.salary).replaceAll("[\\[\\](){}]","")<br />log.info salary<br /><br />WritableWorkbook workbook = Workbook.createWorkbook(new File("c:\\Users\\Desktop\\TD_Write_SoapUI.xls"))<br />WritableSheet sheet = workbook.createSheet("Worksheet 1", 0)<br /><br />Label label1 = new Label(0, 1, age); <br />sheet.addCell(label1);<br />Label label2 = new Label(1, 1, id); <br />sheet.addCell(label2);<br />Label label3 = new Label(2, 1, name);<br />sheet.addCell(label3);<br />Label label4 = new Label(3, 1, salary); <br />sheet.addCell(label4);<br /><br />workbook.write()<br />workbook.close()<br /><br />anuradhahttps://www.blogger.com/profile/10159232504665047230noreply@blogger.comtag:blogger.com,1999:blog-3806208351698608392.post-341839403562732502020-02-29T16:41:27.989+05:302020-02-29T16:41:27.989+05:30Good to know that this script works perfectly. You...Good to know that this script works perfectly. You can use the log.info method to check the response value that you want to write. Consider my tips to write response values in Excel: <br />1) Add the statement import jxl.write.*<br />2) Use code like Sheet1.addCell(new jxl.write.Label(2,count,"test response value"))<br />3) Add WorkBook1.write() statement before the WorkBook1.close() statement above.Inder P Singhhttps://www.blogger.com/profile/05923580987480854491noreply@blogger.com