[SoapUI 5.2.1] mockRequest is NULL in REST MockService
I'm using SoapUI 5.2.1 and I have a REST MockService. Whenever I try to implement the following script, I get the NullPointerException . Script: def requestBody = mockRequest.getRequestContent() log.info "Request body: " + requestBody Error: com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; java.lang.NullPointerException: Cannot invoke method getRequestContent() on null object This is a very frustating error that I'm continuously getting, and surprisingly there is no helpful solution anywhere. Please Help!!!! PS : I'm trying to get the content of a HTTP GET request.Solved22KViews0likes14CommentsSOAP UI - Basic Authentication - where do I find it in Server Code?
I have a SOAP Server written in PHP - and am Testing using SOAP UI. Everything works fine and returns results as expected. I am now trying to add in Basic Authentication - have set up in SOAP UI with Username and Password - BUT can't find how to check it in the Server code? I was expecting the credentials to be in the [SERVER] object passed to the server - but they are not. Can anyone help and advise how I check these items? Thanks PhilSolved12KViews0likes11CommentsPOIXMLTypeLoader Error when trying to write to XLSX file
I have been trying to develop a groovy script to write to an xlsx fiel and I am trying to use APache POI to do that. I have attached my script (I have played around with every variation of this that I can think of, so it not very pretty right now). I have also included all Apache POI files in the lib folder for ReadyAPI and I have checked my buildpath and deleted any old references and any old version of the POI jars. I still keep getting the following error after everything I have tried. Error: Tue Apr 09 15:32:51 MST 2019: ERROR: org.apache.poi.ooxml.POIXMLException: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader org.apache.poi.ooxml.POIXMLException: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:66) at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:657) at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:180) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:282) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:88) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:116) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory$createWorkbook.call(Unknown Source) at Script1.run(Script1.groovy:19) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:98) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:158) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:331) 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: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56) at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63) ... 14 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:86) ... 20 more11KViews0likes1CommentHow to create html file in groovy script and how to use dynamic values from response to html code
How to create html file in groovy script and how to use dynamic values from response to html code Basic HTML code in groovy will be little helpful for me and dynamically need to change value in html code which I will get from API responses Please respond anything is fine Thanks in advance AlexKaras Marsha_R @richieSolved8.2KViews0likes7CommentsDynamic date REST parameter?
Is there any way to define a REST parameter that will automatically take like tomorrow's date? I tried this, but don't know what's really possible or what the syntax would be for more complicated steps: ${=import java.util.Calendar; Calendar now=Calendar.getInstance(); now = now.add(Calendar.DATE, 1); new java.text.SimpleDateFormat("yyyy-MM-dd").format(now.getTime())} According to the raw value, "now" is null when now.getTime() is called.Solved7.8KViews0likes7CommentsProperty Transfer failed when run through maven maven build
hello everyone! I need your quick help. I have a problem when i run my little SoapUI Project with cmd (Winodws 10 & SoapUI Verison 5.6.0). My project consists of two calls, where from the response of the first call an attribute into the second call. When I run the test case in SoapUI everything works fine. Now I have saved the project as XML and included it in the build process of my POM. When I start the project via cmd, it also runs the first call and recognizes it as valid. But when the property transfer is pending, it gives the following error: 11:00:43,526 INFO [SoapUITestCaseRunner] running step [Property Transfer] java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @20890a1a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:130) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:86) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.stdclasses.CachedClosureClass.<init>(CachedClosureClass.java:29) at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:269) at org.codehaus.groovy.reflection.ClassInfo.access$400(ClassInfo.java:36) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:435) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:426) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:89) at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:189) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:93) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71) at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33) at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62) at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32) at net.sf.json.groovy.JsonSlurper.<init>(JsonSlurper.java:46) at net.sf.json.groovy.JsonSlurper.<init>(JsonSlurper.java:43) at com.eviware.soapui.support.JsonUtil.isValidJson(JsonUtil.java:32) at com.eviware.soapui.support.JsonPathFacade.<init>(JsonPathFacade.java:37) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfer.readSourceValue(PropertyTransfer.java:347) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfer.transferProperties(PropertyTransfer.java:317) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfersTestStep.run(PropertyTransfersTestStep.java:125) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfersTestStep.run(PropertyTransfersTestStep.java:103) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:129) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:831) 11:00:44,278 ERROR [AbstractTestRunner] Exception during Test Execution java.lang.ExceptionInInitializerError at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62) at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32) at net.sf.json.groovy.JsonSlurper.<init>(JsonSlurper.java:46) at net.sf.json.groovy.JsonSlurper.<init>(JsonSlurper.java:43) at com.eviware.soapui.support.JsonUtil.isValidJson(JsonUtil.java:32) at com.eviware.soapui.support.JsonPathFacade.<init>(JsonPathFacade.java:37) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfer.readSourceValue(PropertyTransfer.java:347) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfer.transferProperties(PropertyTransfer.java:317) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfersTestStep.run(PropertyTransfersTestStep.java:125) at com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfersTestStep.run(PropertyTransfersTestStep.java:103) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:129) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:831) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @20890a1a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:130) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:86) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:211) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:101) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:71) at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33) ... 20 more 11:00:44,331 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [TestCase - Symptom], time taken: 487ms, status: FAILED 11:00:44,333 INFO [SoapUITestCaseRunner] Project [Project 1] finished with status [FAILED] in 1602ms [ERROR] java.lang.Exception: TestCase [TestCase - Symptom] failed without assertions I also have a sample project without property transfer and everything runs without errors when I start it via the cmd, so it can really only be the property transfer. Have any of you ever had this problem? I really need your help!Solved6.8KViews0likes4CommentsJsonSlurplerGetting Error while Parsing the Json Response
I tried to create a groovy script to parse the JSON response to a variable using JsonSlurper. Though the response Json is in valid format, i am getting an error def responseContent = testRunner.testCase.testSteps["Neme fof the test step"].testRequest.response.contentAsString def Response = new JsonSlurper().parseText(responseContent) log.info Code Could some one please look into this issue provide me a workaround for this. Thanks in advance5KViews0likes20Commentsscript assertion
Hi, not being a programmer could anyone suggest a way to check if the property "apples" has a number rather than just null for example. So below is the result of running a test. I can easily ask SOAP to check if there is an item called "apples" but I have no idea how to ask if "apples" equals a numerical value- any value not just 111. { "CONTENT": { "apples": 111, }, .......in my own language.... I have a test in SOAP- one element of that test = "apples". I want to add a SCRIPT Assertion that checks that the test has created a Value for "apples" and not just a blank or "0". thanks in advance .....almost total non-programmerSolved4.8KViews0likes7CommentsGet Soap Response and Soap Requests of all Test Steps in a Testcase
Hi everyone, I started using the free version of SOAP UI recently and was wondering how to properly implement a loop to get the soap Response and Request of every test step and collate them into a file. I also looked into the API documentation but I was lost and I don't know which one to use. Anyway, I was able to retrieve a specific teststep response and request using the code below. def response = context.expand( '${TestStepName#Response}' ) def rawrequest = context.expand( '${TestStepName#RawRequest}' ) def soapresponse = 'c:/users/Desktop/soapoutput/a.doc' def soaprawrequest = 'c:/users/Desktop/soapoutput/b.doc' def f = new File(soapresponse) def g = new File(soaprawrequest) f.write(response, "UTF-8") g.write(rawrequest, "UTF-8") I also searched the net and found this snippet regarding the teststep loop //Define the object for the collection of requests in the soapUI test case def soapuiRequests = testRunner.testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep ) //Groovy Script to loop through each requests in the test case. soapuiRequests.each{ //Creating file name using current date and time //Writing soapUI response to the file inputFileResponse.write(context.testCase.getTestStepByName(it.name).getProperty('response').value) //Writing soapUI request to the file inputFileRequest.write(context.testCase.getTestStepByName(it.name).getProperty('request').value) Date startTime = new Date(); def cur_Time = startTime.getMonth() + "_" + startTime.getDate(); cur_Time = cur_Time + "_" + startTime.getHours() + startTime.getMinutes() +startTime.getSeconds() def fileName = it.name + "_" + cur_Time def inputFileRequest = new File("C:/Users/Desktop/soapoutput"+ "Request_" + fileName+".txt") def inputFileResponse = new File("C:/Users/Desktop/soapoutput"+ "Response_" + fileName+".txt") } There were no problems during the execution of the script but the file is not generated. This is the response after execution. Any help will be much appreciated. Just an update, Using the code below I can now extract the soap response from each teststep. Unfortunately this also retrieves the value of "response" from all test steps including groovy step, etc. which results to "null" being displayed in the log output.Also "a.doc" has no content. // This will get the list of all testSteps in the testCase def testSteps = context.testCase.getTestStepList() testSteps.each{ //The variable definition below will loop through the teststep abd retrieve the response def z = context.testCase.getTestStepByName(it.name).getPropertyValue('response') def soapresponse = 'c:/users/Desktop/soapoutput/a.doc' def f = new File(soapresponse) log.info(z) //def soaprawrequest = 'c:/users/Desktop/soapoutput/b.doc' //def g = new File(soaprawrequest) //g.write(rawrequest, "UTF-8") //def zz = context.testCase.getTestStepByName(it.name).getPropertyValue('response') //log.info(zz) }4.2KViews0likes0CommentsHow do you use a Groovy script to clone a TestSuite from one project to another?
I found the interface Interface CloneTestSuiteAction.Form in the SoapUI API docs, but I am unsure how to use to it to implement the cloning. The clone would be something like moving the TestSuite "Example" from Project 1 to Project 2. Any help would be greatly appreciated. Thanks!Solved4.1KViews0likes5Comments