ContributionsMost RecentMost LikesSolutionsRe: JSONPath Existence Path error - InvalidPatchException further research into a solution brought me to: https://community.smartbear.com/t5/ReadyAPI-Questions/Groovy-Script-assertion-always-passes-even-though-the-values-don/td-p/226473 Working through the below Groovy but its giving me a NullPointerException on cannot get property 'familyName' on null object error at line 52 which is this value:slurpedResponse[i].foundEntity.entityDetails.NameDetails[j].familyName Assertion works but why the null exception? and why null data returned for this array in the 2nd FOR loop? import groovy.json.* import groovy.util.* def jsonText = ''' { "parent": [ { "country": "RO", "statusCode": "NotFound" }, { "country": "UK", "statusCode": "Found", "foundEntity": [ { "respondingArea": "Authority", "entityDetails": { "NameDetails": { "familyName": "Smith", "firstName": "John" }, "respondingArea": "Authority2", "entityDetails": { "NameDetails": { "familyName": "Daniels", "firstName": "Mike" } } } } ] } ] } ''' //remove the parent level and parse to the actual content def slurpedResponse = new JsonSlurper().parseText(jsonText).parent log.info (slurpedResponse) def count = slurpedResponse.Size for(i=0; i< count ; i++) { log.info ("Current country: " +slurpedResponse[i].country) if(slurpedResponse[i].country=="UK"){ log.info(" Current status Code: " +slurpedResponse[i].statusCode) if(slurpedResponse[i].statusCode == "Found") { def countsub = slurpedResponse.foundEntity.Size log.info ("Count of sub element: " +countsub) for (j=0; j<countsub; j++){ log.info (j) log.info (slurpedResponse[i].foundEntity.entityDetails.NameDetails[j]) log.info (" familyName: " +slurpedResponse[i].foundEntity.entityDetails.NameDetails[j].familyName) if (slurpedResponse[i].foundEntity.entityDetails.NameDetails[j].familyName=="Smith"){ log.info ("current familyName: " +slurpedResponse[i].foundEntity.entityDetails.NameDetails[j].familyName) assert slurpedResponse[i].foundEntity.entityDetails.NameDetails[j].familyName == "Smith" } } } } else { log.info("The Name is not found") } } Re: JSONPath Existence Path error - InvalidPatchException if i changed the JSON response to: { "parent": [ { "country": "RO", "statusCode": "NotFound" }, { "country": "UK", "statusCode": "Found", "foundEntity": [ { "respondingArea": "Authority", "entityDetails": { "NameDetails": { "familyName": "Smith", "firstName": "John" }, "respondingArea": "Authority2", "entityDetails": { "NameDetails": { "familyName": "Daniels", "firstName": "Mike" } } } } ] } ] } i tried the following Script Assertion but no joy iterating through the fields to find the FamilyName based on it being within the "UK/Found" parent. comes back with null continuously 😞 import com.eviware.soapui.support.JsonPathFacade def found = 0 def jpf = new JsonPathFacade(messageExchange.responseContent) def testArray = jpf.readObjectValue("parent") log.info (testArray) testArray.each { def country= it.get("country") def statusCode = it.get("statusCode") def familyName = it.get("foundEntity.entityDetails.NameDetails.familyName) log.info ("country: " +country) log.info ("FamilyName: " +familyName) if(country.contains("UK") && statusCode.contains("Found") && familyName.contains("Smith")) { log.info("matching record: $country") found++ } } assert found > 0: "*****Assertion of data combination. did not find***" o the child elements. JSONPath Existence Path error - InvalidPatchException hi all, I have the following JSON response and want to validate that as well as the parent node value checks that the sub elements are also correct. { "parent" : [ { "country" : "RO", "statusCode" : "NotFound" }, { "country" : "UK", "statusCode" : "Found", "foundEntity" : { "respondingArea" : "Authority", "entityDetails" : { "NameDetails" : { "familyName" : "Smith", "firstName" : "John" } } } } ] } When I create a JSONPath existence match Assertion for following: $..[?(@.country=="UK" && @.statusCode=="Found")] && $..[?(@.familyName=="Smith")] I get the below error. "InvalidPathException:Could not parse token starting at position" (after the double ambersand) Testing via Jsonpath.com shows this is a valid jsonPath string and result given correctly. Any alternatives to assert parent and child content that it exists otherwise in ReadyAPI? thanks, Dave Re: One Excel Datasource and Multiple Test cases using Specific Test Case ID within source I haven't returned to this work since my last updatesonya_m. The approach is sound around the assertion comparison and I may have more questions at that time on completion of that. Re: One Excel Datasource and Multiple Test cases using Specific Test Case ID within source thanks for all the detail here. I'm going to work through some examples. Re: One Excel Datasource and Multiple Test cases using Specific Test Case ID within source That makes sense (and I use each day) if you want to use data from "Row 1" in each "Test Step Request". but in my example, I will have different assertions for each "Test Step Request". e.g. Row 1 data for Customer ID1 will have credit limit of 1000 and current sale = 1200 so ASSERTION is FAILED CREDIT CHECK. Row 2 data for CUSTOMER ID 2 will have credit limit of 1000 and current sale = 900 so ASSERTION wil be to check that response is PASSED CREDIT Check. Each test step will have a different test result. I could create multiple Test cases in ReadyAPI but that would mean having multiple datasources to manage with 1 test entry in each excel. messy. Re: One Excel Datasource and Multiple Test cases using Specific Test Case ID within source Working through a Proof of concept i have come up with the below solution: - A groovy script goes to each testcase as per the testcase Identifier in the data source. Datasource excel Groovy to decide on which step to go to: import com.eviware.soapui.support.XmlHolder def testcaseNo = context.expand('${Data Source#TestcaseId}') log.info (testcaseNo) if (testcaseNo=="test001") { log.info ("go to test step: " + testcaseNo) testRunner.gotoStepByName (testcaseNo) } else if (testcaseNo=="test002") { log.info ("go to test step: " + testcaseNo) testRunner.gotoStepByName (testcaseNo) } else if (testcaseNo=="test003") { log.info ("go to test step: " + testcaseNo) testRunner.gotoStepByName (testcaseNo) } else if (testcaseNo=="test004") { log.info ("go to test step: " + testcaseNo) testRunner.gotoStepByName (testcaseNo) } else if (testcaseNo=="test005") { log.info ("go to test step: " + testcaseNo) testRunner.gotoStepByName (testcaseNo) } Groovy after each step to move to the loop and start again on next row: import com.eviware.soapui.support.XmlHolder testRunner.gotoStepByName ("Data Source Loop") log.info ("moved to the Data Source Loop") It will work for myself but there may be better solutions out there. Re: Pass values read from data source to conditional goto to enable test case flow control. seconded - would be good to have. One Excel Datasource and Multiple Test cases using Specific Test Case ID within source Hi, I have the following excel source file Test Case ID CustomerID test001 Cust 001 test002 Cust 002 test003 Cust 002 I want to setup Testcases for e.g. Test002 that is picks up the value of "Cust 002" (which changes from day to day) and check the response via assertion that its correct. how do I parse the excel file and find "test002" and input that value to that testcase only? I would envisage the layout to be: - Datasource - "test001"REST step - "test002" REST step - "test003" REST step - datasource loop Looks like Groovy script is needed but there could be 100 testcases and associated data in the source file. Thanks Dave other examples with no answers:https://community.smartbear.com/t5/ReadyAPI-Questions/How-to-use-DataSource-and-DataSource-Loop-in-multiple-test-cases/m-p/150457 https://community.smartbear.com/t5/ReadyAPI-Questions/One-datasource-Excel-and-Multiple-Test-Cases/m-p/146569?search-action-id=42105450853&search-result-uid=146569 constant com.eviware.soapui.impl.rest.actions.oauth.OAuth2Parameters.PKCEChallengeMethod.Not defined hi all, I can manually request a token in my Project. if I however use "Inherit from Parent" where I have the Event SubmitListener declared below, I get the following error when a request is sent: Wed Mar 10 14:47:52 GMT 2021: DEBUG: No enum constant com.eviware.soapui.impl.rest.actions.oauth.OAuth2Parameters.PKCEChallengeMethod.Not defined The script is below. Any ideas on why this occurs? // Import the required classes import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2ClientFacade; import com.eviware.soapui.support.editor.inspectors.auth.TokenType; import com.eviware.soapui.model.support.ModelSupport; // Set up variables def project = ModelSupport.getModelItemProject(context.getModelItem()); def authProfile = project.getAuthRepository().getEntry("UAT1"); def oldToken = authProfile.getAccessToken(); def tokenType = TokenType.ACCESS; // Create a facade object def oAuthFacade = new OltuOAuth2ClientFacade(tokenType); // Request an access token in headless mode oAuthFacade.requestAccessToken(authProfile, true, true); // Wait until the access token gets updated //while(oldToken == authProfile.getAccessToken()) {} //The sleep method can be used instead of a while loop //sleep(3000); for(int i = 0; i<=3000; i++){ if(oldToken != authProfile.getAccessToken()){ break } sleep(1) } asd Solved