Contributions
Re: New to Groovy Scripting
Hi, i dont know if its exactly what u need but this works: class Greet { def name; def log Greet(who,log){ this.name = who[0].toUpperCase() + who[1..-1] ; this.log = log; } def salute(){ log.info "Hello "+ name+"!"; } } g = new Greet('world', log); g.salute(); MartinS629Views0likes0CommentsGetting Started with JMS testing in soapUI 4.5.1. Pro
Hi, I am following instructions in your tutorial 'Getting started with JMS testing' and i have some problems with setting up new session in Hermes. I have downloaded ActiveMQ, and received an error about my Java_Home was not set. I updated variable to C:\Program Files\Java\jre7. I restarted activeMQ. In soapUI 4.5.1 i started Hermes JMS. I created new session and in provider tab i added two jar files. I am being asked if scan should be made. I selected Scan for both files. When Selecting session Tab, I can't get the same values in the fields as in your description. In the session field in top I can only select New or Files. If i select new and try to select ActiveMQ in Plug in, i get an error 'Unable to locate this plugin...' Can you help me please? SoapUI version - 4.5.1. Pro HermesJSM version - v1.14 JDK - jre7 Regards, Martin923Views0likes0CommentsRe: Heirarchical DataSource Parameterize Array Element Request
I think there are 2 options (the only 2 options i know ): First make a XML with multiple parents and sons and their sons ect... For example XML will containt 10 parents every parent will have 10 children. Then you can have data source which will get data from excel sheet. Then link Test Request with data source. Example: Excel sheet example: Data source will import first row. Then you will have xml request like this (this is only small example): <ns1:People xmlns:ns1="http://www.example.org/ParentChildGrandChild"> <ns1:Person> <ns1:Name>${import_data#parentName}</ns1:Name><ns1:Age>${import_data#parentAge}</ns1:Age> <ns1:Child> <ns1:Name>${import_data#ChildName1}</ns1:Name> <ns1:Age>${import_data#ChildAge1}</ns1:Age> </ns1:Child> <ns1:Child> <ns1:Name>${import_data#ChildName2}</ns1:Name> <ns1:Age>${import_data#ChildAge2}</ns1:Age> </ns1:Child> </ns1:Person></ns1:People> The point is that XML will have around 10 parents and every parent will have 5 children (the number of parents and children depend on you). Then in Test Request property set Remove Empty Content on true. This will clear all empty XML elements. So when you dont have value in excel sheet then XML element will be empty and this will remove all of them. Example: I tryed to attach picture of example excel sheet. It should be somewhere above. There are 2 parents with 2 children each. So XML will have 2 parents with 2 children and values will be mapped to data source as example above. All values will be send to Test Request and fill all fields in there. Then Remove empty content remove all empty elements so you will get clean XML with same number of parents/childs set in your excel sheet. The second: Same principle but this one use java library (only for SoapUI Pro 4.5.0). I am using this option only when i cant use remove empty content (for example when you have in test request empty element msgParams which cant be deleted). Regards, MartinS1.1KViews0likes0CommentsRe: Heirarchical DataSource Parameterize Array Element Request
Actualy i dont realy know what you want... So can you give a litle bit more information? So u have default request - something like this: <parent> <name>Dad1</name> <age>50</age> <child> <name>Son1</name> <age>30</age> </child> </parent> And you want to randomly generate number of parents with children or you want to generate xml, based on data from data source? Examples: Randomly <parent> <name>Dad1</name> <age>random_value</age> <child> <name>Son1</name> <age>random_value</age> </child> <child> <name>Son2</name> <age>random_value</age> </child> </parent> <parent> <name>Dad2</name> <age>random_value</age> <child> <name>Son1</name> <age>random_value</age> </child> </parent> XML based on data from data source Data source will get a row: Parent; parentAge, son1; son1Age; son2, son1Age; dad1;50;son1;15;son2;20; Then groovy sctip will generate XML based on data, in this example: <parent> <name>Dad1</name> <age>50</age> <child> <name>Son1</name> <age>15</age> </child> <child> <name>Son2</name> <age>20</age> </child> </parent> Regards, MartinS1.1KViews0likes0CommentsRe: Adding xml element to test request using groovy
Hello. Make a property in your project (tab overview). Like this: name: xmlTag value: <ns15:containerStatusIdentifier xsi:nil="true"/> then place in your test request: ${#Project#xmlTag} I think this is the easiest way to do it without using groovy. Regards, MartinS586Views0likes0CommentsRe: LOAD TEST - Limit 60 seconds for 30 threads -data source
Hello. I think that your load test will work like this: You have 37 entries and 30 threads. Then every thread will take your excel sheet and run your all test steps (so if you dont have loop there it will run only once with first row). Your limit is 60 seconds. Then every thread will keep running all test steps in test suite for 60seconds. If u didnt check "Cancel running Test Cases when Limit has been reached" in load test options it will keep runing forever i think. And one friendly advice: make a backup of your excel sheet. Sometimes happens that SoapUI delete it . Hope this helps Regards MartinS659Views0likes0CommentsRe: Random Value Generation
Hello. Try to make a property in property list (its located in project overview). Example: Property name: uniqueId Place this as a value parameter: ${= String.format('6%tH%<tM%<tS%<tL', new Date())}. The result is "6actualtime". Now place this ${#Project#uniqueId} anywhere you want as a value parameter. Hope this helps. Regards Martin701Views0likes0CommentsSoapUI Pro inline request parameterization
Hello. I have problems with importing Java JAR to SoapUI Pro 4.5.0 Beta. I wanted to use my methods in Test Request to add specific content in XML. Can someone help me please? I tryed it out with simple JAR file: Jar file name: MyLib package: lib class: ParameterUtils simple method: setParams - returning String content package lib; public class ParameterUtils { public static String getParams() { String param = "something"; return param; } } I placed this JAR file in "c:\Program Files\SmartBear\soapUI-Pro-4.5.0-Beta1\bin\ext" folder. Restarted the SoapUI. Now i have TestRequest with simple XML: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mds="http://www.cpoj.cz/jip/xsd/mds/mds" xmlns:req="http://www.cpoj.cz/jip/xsd/mds/mds/partnercreate/req"> <soapenv:Header/> <soapenv:Body> <mds:partnerCreate> <req:msg msgUid="cpas\ipcp_esp" msgType="msg_mds_partnercreate_req" msgSourceSystem="22" msgVersion="100" msgTargetSystem="0" msgId="0"> <req:msgParams/> ${=MyLib.lib.ParameterUtils.getParams()} <req:msgData> <req:systemModified> I want to place content here with groovy.</req:systemModified> </req:msgData> </req:msg> </mds:partnerCreate> </soapenv:Body> </soapenv:Envelope> I tryed ${=MyLib.lib.ParameterUtils.getParams()}, but its not working. Can someone help me please?985Views0likes1CommentRe: Inserting data to excel with Groovy script
Hi Jain. I tryed to make a script where i am accesing data in one sheet and inserting them to another sheet in one excel. Workbook excelFile= Workbook.getWorkbook(new File("c://test.xls")); Sheet inputSheet = excelFile.getSheet("Sheet1"); Sheet outputSheet = excelFile.getSheet("Sheet2"); Now i have excel file and sheet. And the only think i can do is to read cell content (Cell A = inputSheet.getCell(Columm, Row) ).So i tryed something with WritableWorkbook, sheet and cell. But i didnt find if WritableWorkbook can read existing excel file and then change content of this file. The only thing which works in some way is this sample: import jxl.*; import jxl.write.* Workbook workbook = Workbook.getWorkbook(new File("d:\\test.xls")); WritableWorkbook copy = Workbook.createWorkbook(new File("d:\\tmp.xls"), workbook); Sheet sheet1 = copy.getSheet("Doc Input"); WritableSheet sheet2 = copy.getSheet("Doc Response"); CL = 0; rows = sheet1.getRows(); for( tc_row in 1..rows-1){ WritableCell tmpA = sheet1.getCell(CL,tc_row); String s1 = tmpA.getContents(); Label label = new Label(CL,tc_row,s1); sheet2.addCell(label); } copy.write(); copy.close(); workbook.close(); But in this sample i am creating new excel file which i dont want I started to learn soapUI and Groovy 5 days ago so be patient with me please Martin32KViews0likes0CommentsInserting data to excel with Groovy script
Hello, i am trying to make a groovy script which reads data from excel and inserting them to the same excel but on different sheet. Is there any possiblity to do it with Groovy? Actually i tryed something but it doesnt work how i want I have excel file "doc_import_detail.xls" and there are 2 sheets, "import response" and "index request". I want to read some data from "import response" sheet and insert it to "index request" sheet. In soapUI pro it can be done with 2 data sinks but i have to insert multiple datas to differents sheets so i dont think that its good to have multiple data sinks in one test case.... So i wanted to try write a script which can save data from response to excel sheets. I red a lot of tutorials about writing to excel but all of them are creating whole new excel workbook. I want 1 existing workbook with multiple sheets and inserting data from response to multiple sheets by one groovy script. If u can give me some link where i can learn how to do that i will be gratefull(u can give me a sample source code too ).39KViews1like11Comments