Getting java.lang.NoClassDefFoundError in Ready API
HI all, I have a need where I need to come up with a function which with return a Jason to map Json { "a": { "b": 1, "c": null, "d": [false, true] }, "e": "f", "g": 2.3 } Map Key Value a.b 1 a.c null a.d[0] false a.d[1] true e f g 2.3 This can be done using JsonFlattener jar and was implemented in Eclipse, so added that external Jar in Ready API under “Custom Java libraries” but on executing this function it error out with message “java.lang.NoClassDefFoundError”, can some one please help me how this can be resolved. Below is the code import com.github.wnameless.json.flattener.JsonFlattener; public def func1(def expected){ def resultMap = [ : ]; resultMap = JsonFlattener.flattenAsMap(expected) return resultMap; }Solved1.9KViews0likes5CommentsCompare two REST response and ignore some fields
to compare two json response i can use below function but in the current context response return some dynamic fields which will be unique every time, can some one please explain how we can handle this void compareResponse(def atcualresponse, def expectedREsponse){ def map1 = new JsonSlurper().parseText(atcualresponse) def map2 = new JsonSlurper().parseText(expectedREsponse) assert map1 == map2 }Solved4.4KViews0likes7CommentsHow to save log.info/error/warning from groovy test step
Hi, I have big groovy script usable in both SoapUI Free and SoapUI pro. i have there lots of Log Outgoing how to save them by groovy script? all logs i found and try some kudos have result like this: /***********************enum test*************/ import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus // firsthly def ArrayList - enums // this enums is available for change if another enums will change, dont change another part of code List<String> country = new ArrayList<String> (["MK", "AD", "AE", "AF"]) //, "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "CH", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]) log.info "!!!!!!!Dont stop this Test Step!!!!!!!!!" log.info "!!!!!!!Dont change this Test Step when run!!!!!!!!!" log.info "!!!!!!!Wait for results at least 10 minutes!!!!!!!!!" //def actual test Case and Test STep def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def testCase = testRunner.testCase; def testStep = testCase.getTestStepAt(context.currentStepIndex + 2); //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", country[0]) //log.info testStep + ": " + country[0] //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); // here we detect if test case were failed (when is not firsth if, then list all assertion test steps in test case, is usable as Tear Down Script too) def StepList = testCase.getTestStepList() if (country != country[0] && country[0] != null){ StepList.each{ if(it.metaClass.hasProperty(it,'assertionStatus')){ if(it.assertionStatus != AssertionStatus.FAILED){ log.error "${it.name} FAIL with value of: " + item return; } else if(it.assertionStatus == AssertionStatus.VALID){ log.info "${it.name} OK!" // now loop arrayList value by value it means item and run it in Test step MTD-ESB-TLM-Country-all (next 1th test step) for (String item : country) { //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", item) //log.info testStep + ": " + item //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); } } else if(it.assertionStatus == AssertionStatus.UNKNOWN){ log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)" log.error "${it.name} FAIL with value of: " + item return; } } } } }/***********************enum test*************/ import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus // firsthly def ArrayList - enums // this enums is available for change if another enums will change, dont change another part of code List<String> country = new ArrayList<String> (["MK", "AD", "AE", "AF"]) //, "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "CH", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]) log.info "!!!!!!!Dont stop this Test Step!!!!!!!!!" log.info "!!!!!!!Dont change this Test Step when run!!!!!!!!!" log.info "!!!!!!!Wait for results at least 10 minutes!!!!!!!!!" //def actual test Case and Test STep def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def testCase = testRunner.testCase; def testStep = testCase.getTestStepAt(context.currentStepIndex + 2); //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", country[0]) //log.info testStep + ": " + country[0] //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); // here we detect if test case were failed (when is not firsth if, then list all assertion test steps in test case, is usable as Tear Down Script too) def StepList = testCase.getTestStepList() if (country != country[0] && country[0] != null){ StepList.each{ if(it.metaClass.hasProperty(it,'assertionStatus')){ if(it.assertionStatus != AssertionStatus.FAILED){ log.error "${it.name} FAIL with value of: " + item return; } else if(it.assertionStatus == AssertionStatus.VALID){ log.info "${it.name} OK!" // now loop arrayList value by value it means item and run it in Test step MTD-ESB-TLM-Country-all (next 1th test step) for (String item : country) { //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", item) //log.info testStep + ": " + item //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); } } else if(it.assertionStatus == AssertionStatus.UNKNOWN){ log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)" log.error "${it.name} FAIL with value of: " + item return; } } } } } It means: it log only part of code, but not log.info/error/warning... from Log Output with the values of variables - I may made it manualy, but I want execute all project from command line its general task from our DevOps. How to script it in both versions (not all testers here have full version) Thanks for answer1.2KViews0likes3CommentsReadyAPI- How to assert 2 test runs based on date in response?
Hello, As our project is evolving fearcely I'm now on a crossroad to assert that my response from the new run is updated with the latest version of the third party. Some explanations: Testrun1: Response comes from our environment in JSON format that was filled through ETL with an image from a third party. It should contain a 'PDCMetaData' (wrong notation in the screenshot) and a 'PDCData' node (with content that differse for each project). In the 'PDCMetaData' there's a DateTime stamp in 'authorityProcessingDateTime' that shows e.g. 31/12/2018 It should look something like this: TestRun2: A new version was uploaded through ETL to our environment and the DateTime in 'PDSMetaData' is now 31/12/2019. How can I assert that this date is changed and shows me that a new version is present? Could anybody give me an idea please? Thanks in advance, Kind Regards, AboveAndBeyond986Views0likes2CommentsHow to put a parameter from a JSON URL response in a REST Request
Hello, For my project I need to read a JSON response through a URL. I've managed to do so, but now I should put a particular property into the REST Request. How can I do this please? So far: //cfr. https://www.leveluplunch.com/groovy/examples/get-webpage-content-url-uri/ //https://community.smartbear.com/t5/SoapUI-Pro/How-to-Parse-a-JSON-Response-Using-Groovy-Examples/td-p/155770 import groovy.json.JsonSlurper def getConceptSchemes = "https://LinkToMyEnvironment".toURL().getText() //parse json string using JsonSlurper - basically converts it to a groovy list def parsedJson = new groovy.json.JsonSlurper().parseText(getConceptSchemes) //get data def findAGC = parsedJson.find { it.name == 'ACTIVITY_GROUP' } log.info "result for specific beID: " + findAGC This gives me the answer from the Json response. This is a first step in my TestCase. The second step is a REST Request with parameter 'beId' that I need to fetch from the response. Response: {"beId":"d4f897d05508caa12d77d732ffbc652f821c0a16c2f457277c2565f0b890f62e","name":"ACTIVITY_GROUP","reportingAuthority":"KBO","links":[{"rel":"self","href":"http://LinktomyEnvironment/d4f897d05508caa12d77d732ffbc652f821c0a16c2f457277c2565f0b890f62e{?lang}"}]}, How can I do so please? Thanks in advance AABSolved2.2KViews0likes2Commentsjson block as a property value
Is it possible to have a json block as my property value? { "firstName": "John", "lastName" : "doe", "age" : 26, "address" : { "streetAddress": "naist street", "city" : "Nara", "postalCode" : "630-0192" } I tried it by making it a single line and it worked. However, when it comes to large json data, it will be very hard to maintain it.Solved5.1KViews0likes8CommentsMaven Soapui Plugin with json assertions does not work well in junit test
Maven Soapui Plugin with json assertions does not work well when i use last respository version in a maven project: <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-maven-plugin</artifactId> <version>5.1.3</version> Logs: 17:37:26,465 ERROR [TestAssertionRegistry] Missing assertion for type [JsonPath RegEx Match] 17:37:26,482 ERROR [TestAssertionRegistry] Missing assertion for type [JsonPath Count] When will it be released 5.1.2 version to be able to use this type of assertion? A lot of thanks!!!!! Cristian Romero Matesanz3.9KViews0likes3CommentsGet unexpected char: 0xFFFF exception when try to URLEncode JSON request
I am trying to send URLEncoded request. In order to URLEncode my request I am using following code in my request body: =${=java.net.URLEncoder.encode("""{ 'Guid': '934172bb-80d2-4888-a2e6-2ec6015df5dc', 'DateTime': '2016-03-16T00:00:00+00:00' }""", java.nio.charset.StandardCharsets.UTF_8.toString())} When I try to send the request I get following exception: =startup failed: Script17.groovy: 4: unexpected char: 0xFFFF @ line 4, column 1.org.codehaus.groovy.syntax.SyntaxException: unexpected char: 0xFFFF @ line 4, column 1. at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:138) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:237) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:167) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:694) at groovy.lang.GroovyShell.parse(GroovyShell.java:706) at groovy.lang.GroovyShell.parse(GroovyShell.java:742) at groovy.lang.GroovyShell.parse(GroovyShell.java:733) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:138) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:89) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:79) at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:165) at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolver.java:145) at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:211) at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:156) at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:152) at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:135) at com.eviware.soapui.impl.wsdl.submit.filters.HttpRequestFilter.filterHttpRequest(HttpRequestFilter.java:320) at com.eviware.soapui.impl.wsdl.submit.filters.RestRequestFilter.filterRestRequest(RestRequestFilter.java:31) at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterAbstractHttpRequest(AbstractRequestFilter.java:42) at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:34) at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.filterRequest(HttpClientRequestTransport.java:378) at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:183) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:119) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: Script17.groovy:4:1: unexpected char: 0xFFFF at org.codehaus.groovy.antlr.parser.GroovyLexer.mSTRING_CTOR_END(GroovyLexer.java:2345) at org.codehaus.groovy.antlr.parser.GroovyLexer.mSTRING_LITERAL(GroovyLexer.java:1942) at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:478) at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:262) at groovyjarjarantlr.TokenBuffer.fill(TokenBuffer.java:69) at groovyjarjarantlr.TokenBuffer.LA(TokenBuffer.java:80) at groovyjarjarantlr.LLkParser.LA(LLkParser.java:52) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.pathExpression(GroovyRecognizer.java:11680) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.postfixExpression(GroovyRecognizer.java:13410) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.unaryExpressionNotPlusMinus(GroovyRecognizer.java:13379) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.powerExpressionNotPlusMinus(GroovyRecognizer.java:13083) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.multiplicativeExpression(GroovyRecognizer.java:13015) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.additiveExpression(GroovyRecognizer.java:12685) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.shiftExpression(GroovyRecognizer.java:9921) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.relationalExpression(GroovyRecognizer.java:12590) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.equalityExpression(GroovyRecognizer.java:12514) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.regexExpression(GroovyRecognizer.java:12462) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.andExpression(GroovyRecognizer.java:12430) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.exclusiveOrExpression(GroovyRecognizer.java:12398) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.inclusiveOrExpression(GroovyRecognizer.java:12366) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalAndExpression(GroovyRecognizer.java:12334) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.logicalOrExpression(GroovyRecognizer.java:12302) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.conditionalExpression(GroovyRecognizer.java:4956) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.assignmentExpression(GroovyRecognizer.java:8122) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expression(GroovyRecognizer.java:10061) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expressionStatementNoCheck(GroovyRecognizer.java:8449) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.expressionStatement(GroovyRecognizer.java:8995) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.statement(GroovyRecognizer.java:1278) at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:668) at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:134) ... 34 more 1 error """, java.nio.charset.StandardCharsets.UTF_8.toString())} The issue is with {. If I remove {, I don't get any exception. I also tried to escape { using \ but it didn't work. Any help would be appriciated. Thanks, Ritesh6.5KViews0likes3CommentsSoapUI NG Pro 1.4.0 - JSON Response view removing decimal points
Hello, I am testing REST API's. I just upgraded to 1.4.0. On my tests, I have a content assertion for an account balance field. This has always been set to validate a content of '0.0'. However after upgrading, this assertion always fails. Expected 0.0, Actual 0. 1.4.0 is removing the decimal point in JSON view, the raw response still contains the decimal point. Example of Raw response: { "OutstandingBalance": 0.0 } Example of JSON View tab for same element: { "OutstandingBalance": 0 } Can this be investigated please as all of my existing tests (of which there are a lot) are failing because of this. It is the0.0 value I am expecting to see. Please let me know of any additional information that may be needed. ThanksSolved5.8KViews0likes9Comments