Caused by: groovy.lang.MissingPropertyException: No such property: testCase for class: Script2
I'm using below script to get the error message from test-step in listener level. I place this script under TestRunListener.afterRun def logPrefix = testCase.getName() + ': ' log.info (logPrefix + 'Number of results = ' + testRunner.getResults().size().toString()) for(result in testRunner.getResults()){ if(result.getStatus().toString() != 'PASS' ){ def failedTestStepName = result.getTestStep().getName() def logPrefixStep = logPrefix.trim() + failedTestStepName + ': ' log.error(logPrefixStep + 'TestStep "' + failedTestStepName + '" finished with the status ' + result.getStatus().toString()) for(testProperty in testCase.getTestStepByName(failedTestStepName).getPropertyList()){ if(testProperty.isReadOnly()){ log.info(logPrefixStep + 'Output property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) }else{ log.info(logPrefixStep + 'Input property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) } } for(message in result.getMessages()){ log.error(logPrefixStep + 'Error message: ' + message) } } } whenever running my test cases. I'm getting below error Thu Nov 21 15:32:05 UTC 2019: ERROR: com.eviware.soapui.support.scripting.ScriptException: Error in TestRunListener.afterRun com.eviware.soapui.support.scripting.ScriptException: Error in TestRunListener.afterRun at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:31) at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:80) at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:61) at com.eviware.soapui.eventhandlers.impl.EventHandlersTestRunListener.afterRun(EventHandlersTestRunListener.java:36) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.notifyAfterRun(AbstractTestCaseRunner.java:360) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalFinally(AbstractTestCaseRunner.java:212) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalFinally(AbstractTestCaseRunner.java:1) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:154) 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: groovy.lang.MissingPropertyException: No such property: testCase for class: Script2 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310) at Script2.run(Script2.groovy:4) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(DefaultSoapUIScript.java:42) at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:29) ... 12 more I'm using readyAPI 3.0.Solved27KViews0likes2Commentsjava.io.IOException: UT010029: Stream is closed on DataSourceLoop
Hi, in my ReadyApi project I have a DataSource Loop from 1 to 100 where at each iteration I perform some calls to Soap JAX-WS web services and then I check the consistency of data on database by performing some JDBC assertions. This ReadyApi project runs by downloading and reading the WSDLs from out Java EE 7 application deployed locally in Wildfly 10 by Eclipse. Random, I have the exception whose stack trace can be read in the attached file. What can cause this? Is ReadyApi using an already closed socket on Wildfly?Solved10KViews0likes2CommentsHow to get request body using a groovy script in ReadyAPI
Hi, The request (getDrafts) I'm testing takes a list of periods and reply with a list of data for those periods. Request body: { "periods" : ["202101","202102"] } Response body: { "drafts" : [ { "period" : "202101", "data" : { "name" : "Kalle Kula", "epost" : "kalle@kula.se" } }, { "period" : "202102", "data" : { "name" : "Krille Krokodil", "phone" : "9876543210" } } ] } I would like to create a script that reads the requested periods from the request body, and for each value verifies that there is an item for that period in the response body. I also want to verify the content of the data-part for each item but first things first🙂 The problem is I cannot figure out how to get the contents of the request body from my groovy script. Kind regards, CamillaRSolved8.4KViews0likes6CommentsError getting response;java.net.Unknown HostException
I am not getting any response for a particular api from last week . earlier It was working properly. I didn't change anything in the api. But now iam not getting any response. Getting error message like "Error Getting Respponse; Un"Unknown HostException : 11200-server-xo8.4KViews0likes4Commentsv3.0 (bug?) - swagger compliance assertion fails in v3.0 but is ok in v2.8
Hi, I recently update to v3.0 of readyAPI. Looks nice! However, I notice a difference in behavior on the Swagger Compliance Assertion. Might this be a bug at your end or is this assertion suddenly more strict in the v3.0? And if the latter, why does it flags this a failure? Scenario: Applying swagger compliance assertion to a rest response. In the assertion, I have a swagger url which contains a relative path to a yaml file. Strict validation is enabled (disabling this makes no diffrence to this issue). The validation happens and provides now these failures (note: some items are renamed for privacy reasons): 1) Instance failed to match all required schemas (matched only 0 out of 1) checked node: [/references] corresponding schema: [/properties/references] If this is a valid assertion failure then it is not a clear error message in my opinion. In my JSON response I get back the following for the reference node: Response of my usedResource: "references" : { "aReference" : "93269491-e89b-4f19-9d12-ec09b71aeaec", "bReference" : null, "cReference" : null } Is the error saying that bReference and cReference cannot be null? In my swagger/yaml file reference is defined as: usedResource: type: object description: Description of the request properties: ... references: readOnly: true description: References description allOf: - $ref: '#/definitions/ourReferences' ... ... ourReferences: type: object description: Contains the references properties: aReference: type: string description: The reference a bReference: type: string description: The reference b cReference: type: string description: The reference c 2) Instance type (string) does not match any allowed primitive type (allowed: ["object"]) checked node [/priority] corresponding schema [properties/priority] In my JSON response I get back the following for the reference node: Response of my usedResource: "priority" : "NORMAL" In my swagger/yaml file priority is defined as: usedResource: type: object description: Description of the request properties: ... priority: description: The urgency. allOf: - $ref: '#/definitions/RequestPriority' ... RequestPriority: type: string enum: - NORMAL - URGENT I cannot see what's wrong with this. Other similar nodes with similar type & enum are not resulting in a failure. Again, also v2.8 did not flag this as a failed compliance. I could provide more examples, but I hope these suffice.Solved5.8KViews0likes6CommentsHow can I assert a json parameter in Request with a XML response through Script Assertion in Soap UI
I am using SoapUI version 5.3.0 My Application have a couple of RESTful APIs. I am sending multiple request to a WebService in the form of a json request as below: { "app_key":"i8gAVDwcAq40n2kAv6Ox+w==", "targetDB":"${#TestCase#TARGET_DB}", "createNew": "true" } The response from the WebService is as follows: <StartDataExtractResult xmlns="http://schemas.datacontract.org/2004/07/AriaTechCore" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <StatusCode>1</StatusCode> <StatusText>success</StatusText> <RequestNumber>101</RequestNumber> </StartDataExtractResult> I am using a Groovy Script to generate a dynamic name for "targetDB" as follows: def targetdb = ((context.expand('${#TestCase#TARGET_DB}') ?: 100) as Integer) + 1 log.info "Target db for current request : ${targetdb}" context.testCase.setPropertyValue('TARGET_DB', targetdb.toString()) I have designed my Test data in such a way that passing the parameter of the 'targetdb' as "101" will result in the RequestNumber tag set to "101" in the response. Now I want to add an assertion to check if the RequestNumber tag contains the same value as of the variable "${#TestCase#TARGET_DB}" (sent in Request json) . To achieve that I wrote a Script Assertion as follows: def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def holder = groovyUtils.getXmlHolder(messageExchange.responseContent) holder.namespaces["ns1"] = "http://schemas.datacontract.org/2004/07/AriaTechCore" def nodeRequestNumber = holder.getNodeValue("//ns1:RequestNumber") assert nodeRequestNumber != null if(nodeRequestNumber=="${TARGET_DB}") { log.info "Pass" } else { log.info "Fail"} But I am getting an error as: No such Property: TARGET_DB for class: Script 53 Can any one help me out please?Solved5.6KViews0likes6Comments[TechCorner Challenge #7] Change an XPath Match assertion to a JSONPath Match assertion
Imagine that the logic of the server has been changed and you started getting responses from the server in the JSON format instead of XML. And, it may appear that XMLPath assertions don’t suit you anymore. In this case, you need to convert all XPath Match assertions to JSONPath Match assertions in your project. There could be a lot of test steps to change, so it’s better to automate this process. Task: Create a script to convert XPath Match assertion to JSONPath Match assertion for the REST test steps where the request URL is the following: https://example.com/test. Difficulty: A script should do this: 1. Add the JSONPath Match assertion to REST test steps that have the https://example.com/test endpoint. 2. Convert the XPath expression and expected result from the XPath Match assertion to the JSONPath expression and expected result for the corresponding test steps. 3. Remove the XPath Match assertions for those test steps. A sample response: JSON XML { "id": 1111, "category": { "id": 0, "name": "string" }, "name": "doggie", "photoUrls": [ "string" ], "tags": [ { "id": 99, "name": "string" } ], "status": "available" } <Response xmlns="https://petstore.swagger.io/v2/pet"> <id>1111</id> <category> <id>0</id> <name>string</name> </category> <name>doggie</name> <photoUrls> <e>string</e> </photoUrls> <tags> <e> <id>99</id> <name>string</name> </e> </tags> <status>available</status> </Response> XMLPath Match assertions example: Condition: declare namespace ns1='https://petstore.swagger.io/v2/pet'; //ns1:Response[1]/ns1:tags[1]/ns1:e[1]/ns1:id[1] Expected result: ${#TestCase#ID} Tips: https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html#working-with https://support.smartbear.com/readyapi/apidocs/soapui/DefaultPackage/XPathContainsAssertion.html https://support.smartbear.com/readyapi/apidocs/pro/DefaultPackage/JsonPathContentAssertion.html Good luck and have fun😊Solved5.4KViews0likes10CommentsAssertion of selective elements in a teststep
Hi, I am using readyapi version 3.1.0 and I am trying to do the database testing using it My test case looks like this Iteration 1- csvdata file-Datasource step step1 step2 step3 XPATH - [AC-1,EX-C-1] XPATH - [AC-2,EX-C-2] XPATH - [AC-3,EX-C-3] step4 step5 step6 Datasource loop Iteration 2- csvdata file-Datasource step step1 step2 step3 XPATH - [AC-1,EX-C-4] XPATH - [AC-2,EX-C-5] XPATH - [AC-3,EX-C-6] step4 step5 step6 Datasource loop When i am looping my test case, all the steps are basically dbase calls only and output of step 3 is also from a table and in the first iteration I am getting few fields & they are asserted using xpath assertion But when i iterate it, input data for step3 changes and now I have 3 different fields in the same step(Step3) which i need to assert It is like execution step3 is same, but it is displaying different output in the same column, because of my input data And my requirement is, I need to assert all the elements using xpath match assertion I am sure it can be achieved by Groovy script, wondering if in this flow I can be able to use readyapi existing components Any help which leads to a direction is highly appreciated. Please let me know, if it needs more clarification.Solved4.5KViews0likes17Commentsassertion difference between two timepoint is lager or smaller than x minutes
Determine how much time there is between two time points and see if this is smaller or larger than x minutes. For example: A train stops in Maastricht at 11.30 and will depart at 13.49. Is the LayOverTime minimal 120 minutes . See atachements. Best regards, AtieSolved4.5KViews0likes6Comments