How to use a regex in groovy for reading a excel file and assign a value.
hallo, I am trying to read an xls file having few columns and rows. I am getting a string value from an api and from this string value i am trying to look into the row having six values. There is an output value which i then compare and assign a closest value to it and choose which columnnamenumber. Let me explain with an example with the picture i have attached. In this case, i get a string value "test8" this excel makes a search and i have already implemented and i get the result for example "test8" with a output value 176. Now the row values which are in test8 are 174 181 192 204 211 My task is in reading this alle row cell values which is assigned to row "test8" If have a output value for a number 176 from the below code def output= bucket.getoutput(). Here maybe i need to use regex. i do not know! i wanted to use it for the previous row value in this case for 174 from six row values. Then it would search for which column header it is assigned, in this case it would be -1. If the output value was somewhere in around 191-204 ex(198). Then it should setcolumn name to +1. Please helpme in building/suggesting it. I have added my class file. I am not getting the right output i need. I have defined in the line def value. ps: Sheet1 code looks for the program from the data slotnumber which is already been implented. case1,case2 is minimumvalue and maximumvalue. I tried : private void calculateweight(BBucket bucket, ZWorkbookImpl workbook) { //find right row, extract data try { def testProgram = bucket.getTestProgram() workbook.goToSheet("Sheet2") workbook.goToPosition(0, 0) //Searches for particular test program in the first column ex:Test8 while(true) { if(workbook.readCell(false).contentEquals(testProgram)) // Here it finds Test8, now how to get the values of row Test8 ?? { workbook.goToNextCell() der value = //Todo "read the values of particular row and take one value which fits" container.getAll(new FilterAllDomainObjects()).each{e -> e.setProgramExtension(value) //calculate program //Store program on the stent } break; } workbook.goToNextRow(false) } } catch (Exception e) { throw new Exception("Error parsing ${fileName} file", e) } }Solved1.1KViews0likes3CommentsRegex
Hi, I was trying to implement something similar to the following https://support.smartbear.com/testcomplete/docs/scripting/regular-expressions.html var regEx3 = /;(\r\n)+function/g; var ReplacementLines = ";\r\n\r\n//A helper routine\r\nfunction"; var test1 = "function Foo(Param1)"; var test2 = test1.replace(regEx3,ReplacementLines); but it does not give me the result as expected. var test = "class=organizationAgentGridInfoRightColumn_Text12345"; var regEx = /<=organizationAgentGridInfoRightColumn_Text>.*/gi; test = aqString.Replace(test,regEx,"abc"); Not sure what I am doing wrong. Is my regex wrong?Solved1.8KViews0likes4CommentsIllegalArgumentException:Unsupported operator = by using regex in JSONPath Count Match
Hello all, I am trying to create a test case with assertion based on JSONPath Count Match and regex. But I get always the error message from SoapUI: Assertion failed for path [$.flightOfferList.flightOffer[*].connectionList.connection[*].segmentList.segment[?(@.departureDateTime =~ /2018-08-15T17:10:00/)]] : IllegalArgumentException:Unsupported operator = If I put the message to check on http://jsonpath.herokuapp.com/ and use the same JSON Path then it works without problems. Is there a bug in SoapUI? (I'm using the version 5.4.0 on Windows). Or is my JSONPath expression wrong? Here is my JSON message, that I'm trying to check: {"flightOfferList": {"flightOffer": [ { "salePrice": 312235, "salesPriceCurrency": "EUR", "onlyWithHotel": false, "ticketTimeLimit": "2018-06-11", "bookingInOptionUntil": "1111-11-11", "sypoCode": "MERC", "agfaCode": "IFBP", "luggageIncluded": true, "status": "VKE", "connectionList": {"connection": [ { "departure": "FRA", "destination": "JFK", "flightDate": "2018-08-15", "serviceClass": "Y", "touristicDepartureDate": "2018-08-15", "touristicArrivalDate": "2018-08-15", "numberOfFlightNights": 0, "segmentList": {"segment": [ { "departure": "FRA", "destination": "JFK", "departureDateTime": "2018-08-15T17:10:00", "arrivalDateTime": "2018-08-15T19:55:00", "carrierCodeMkt": "UA", "carrierCodeOp": "LH", "bookingClass": "Y ", "flightNumber": "8843", "overnight": false, "nonStop": true, "seatReservationPossible": false }]} }]} }, { "salePrice": 313835, "salesPriceCurrency": "EUR", "onlyWithHotel": false, "ticketTimeLimit": "2018-06-11", "bookingInOptionUntil": "1111-11-11", "sypoCode": "MERC", "agfaCode": "IFBP", "luggageIncluded": true, "status": "VKE", "connectionList": {"connection": [ { "departure": "FRA", "destination": "JFK", "flightDate": "2018-08-15", "serviceClass": "Y", "touristicDepartureDate": "2018-08-15", "touristicArrivalDate": "2018-08-15", "numberOfFlightNights": 0, "segmentList": {"segment": [ { "departure": "FRA", "destination": "JFK", "departureDateTime": "2018-08-15T16:00:00", "arrivalDateTime": "2018-08-15T20:00:00", "carrierCodeMkt": "LH", "carrierCodeOp": "LH", "bookingClass": "Y ", "flightNumber": "4838", "overnight": false, "nonStop": true, "seatReservationPossible": false }]} }]} }, { "salePrice": 313835, "salesPriceCurrency": "EUR", "onlyWithHotel": false, "ticketTimeLimit": "2018-06-11", "bookingInOptionUntil": "1111-11-11", "sypoCode": "MERC", "agfaCode": "IFBP", "luggageIncluded": true, "status": "VKE", "connectionList": {"connection": [ { "departure": "FRA", "destination": "JFK", "flightDate": "2018-08-15", "serviceClass": "Y", "touristicDepartureDate": "2018-08-15", "touristicArrivalDate": "2018-08-15", "numberOfFlightNights": 0, "segmentList": {"segment": [ { "departure": "FRA", "destination": "JFK", "departureDateTime": "2018-08-15T16:00:00", "arrivalDateTime": "2018-08-15T20:00:00", "carrierCodeMkt": "LH", "carrierCodeOp": "LH", "bookingClass": "Y ", "flightNumber": "4839", "overnight": false, "nonStop": true, "seatReservationPossible": false }]} }]} }, { "salePrice": 313835, "salesPriceCurrency": "EUR", "onlyWithHotel": false, "ticketTimeLimit": "2018-06-11", "bookingInOptionUntil": "1111-11-11", "sypoCode": "MERC", "agfaCode": "IFBP", "luggageIncluded": true, "status": "VKE", "connectionList": {"connection": [ { "departure": "FRA", "destination": "JFK", "flightDate": "2018-08-15", "serviceClass": "Y", "touristicDepartureDate": "2018-08-15", "touristicArrivalDate": "2018-08-15", "numberOfFlightNights": 0, "segmentList": {"segment": [ { "departure": "FRA", "destination": "JFK", "departureDateTime": "2018-08-15T17:10:00", "arrivalDateTime": "2018-08-15T19:55:00", "carrierCodeMkt": "LH", "carrierCodeOp": "LH", "bookingClass": "Y ", "flightNumber": "404", "overnight": false, "nonStop": true, "seatReservationPossible": false }]} }]} } ]}} And my JSON Path, that I would like to use is $.flightOfferList.flightOffer[*].connectionList.connection[*].segmentList.segment[?(@.departureDateTime =~ /2018-08-15T17:10:00/)] Thanks for any hints!865Views0likes0CommentsLoadUiWeb Data Modifier Regex Issue
Hello, My company has been focusing on realizing load testing on our products before release because new customers continue arriving with a bigger user base. Thus the need for a good load testing solution. Initially we found a product LoadUiWeb 2 that was found in your website and its the product we have fallen in love in using and looking to continue learning and playing with the tools it provides. That said, we have been having issues with one of the features your tool provides related to using Regex in the Data Modifier tabfor SOAP Requests. I have basically followed the chapter you guys include in the Help section on using this part and i haven't had any success in having the regex succesfully finda match and substitute the value. I shall include this example below. For our specific SOAP request I have been using this regex to look for a specific text in the Text part of the request: rst_regardingobjectguid>(.*)</rst_regardingobjectguid Part of the text that is being sent in the request is as follows, the full request will be found attached. <rst_datereported>2016-11-17T12:18:56</rst_datereported><rst_regardingobjectguid>9CECA153-5532-25CA-2D09-6287B4E04DCD</rst_regardingobjectguid> I've tested these Regex using online Regex testers and have been able to correctly identify the part I want to change which is the GUID between the rst_regardingobjectguid tags. Sadly when I run the tests the regex doesnt identify the GUID correctly and the value isn't changed. The variable I defined to change the GUID is a Guid Loadui Web Variable that was auto generated. Please find attached images of my defined variables and my Data Modifier Regex from the LoadUiWeb Application. I am trying to figure out what is it that I am doing wrong.2.6KViews0likes1CommentAsserting a partial XML using regex
Hi All, Is there any assertion in Soapui Pro, that can be used to assert the response XML partially using regex pattern. For Eg : Lets assume the response XML is something like this below: <root> <a1>This is a1 test</a1> <a2>adding a2 text</a2> <a3> <b1>Some random text</b1> <c1>hello</c1> </a3> </root> And i want to assert this xml partially using some regex. Lets say like this below: Contains Assertion: <root> <a1>This is a1 test</a1> *.* </a3> </root> ----------------------------------- When i actually try to do this, it's not working. Can some suggest me the actual regex pattern that can be applied on the above XML to assert its response body. (Note : I am making use of 'contains' assertion) Kindly let me know, if this feature exists (if yes, plz suggest regex for above & if NO, can we add this feature in next release of soapui pro). Thanks Singh8.8KViews0likes9Comments