Contributions
Getting the TestRunner environement
I have a need to retrieve the value for the -E flag (-EProd, -EBeta, etc.) from within a groovy script. I'll start off by saying that testSuite.project.getActiveEnvironment().getName() does not give me the value. It gives me the value that the project file currently has saved, not the value TestRunner overrides with (which makes sense). I ran through your source and the "SoapUITestCaseRunner" class is what handles the cmd line parsing. It sets the environment to a private variable: public void setEndpoint(String endpoint) { log.info( "setting test endpoint to [" + endpoint+ "]" ); this.endpoint = endpoint.trim(); } There is unfortunately is no getter for this. So, from within a teardown script, how could I go about getting the value of this? I WOULD like to find it on some kind of project/suite/runner wide variable (i.e. runner.properties["endpoint"]). I would NOT like to have to access a particular testcase to get it (i.e. runner.testCase.properties["endpoint"]). Thank you!11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.2KViews0likes1CommentcreateReport method signature becomes invalid
I am using the createReport method on the JUnitReportEngine object. Most of the time, everything works fine. Occasionally I get a MissingMethodException that looks like the following: groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.reporting.engine.junit.JUnitReportEngine.createReport() is applicable for argument types: (java.lang.String, com.eviware.soapui.eventhandlers.impl.EventHandlersTestSuiteRunListener, com.eviware.soapui.impl.wsdl.WsdlTestSuitePro, java.lang.String) values: [C:\Temp, com.eviware.soapui.eventhandlers.impl.EventHandlersTestSuiteRunListener@100db9d, com.eviware.soapui.impl.wsdl.WsdlTestSuitePro@11a6737, Single Page (Print)] Possible solutions: createReport(java.lang.String, com.eviware.soapui.report.JUnitReportCollector, com.eviware.soapui.model.ModelItem, java.lang.String) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at Script1.run(Script1.groovy:10) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89) at com.eviware.soapui.impl.wsdl.WsdlTestSuite.runTearDownScript(WsdlTestSuite.java:528) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalFinally(WsdlTestSuiteRunner.java:184) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner.internalFinally(WsdlTestSuiteRunner.java:42) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:163) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:77) at com.eviware.soapui.impl.wsdl.WsdlTestSuite.run(WsdlTestSuite.java:727) at com.eviware.soapui.tools.SoapUITestCaseRunner.runSuite(SoapUITestCaseRunner.java:571) at com.eviware.soapui.SoapUIProTestCaseRunner.runSuite(SourceFile:216) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:403) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:158) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:89) at com.eviware.soapui.SoapUIProTestCaseRunner The code is the EXACT same between runs. I consistantly get this error when I run using the "Launch TestRunner" wizard. When I get this error via running the suite from the TestSuite editor (which is intermitent), I have to restart my computer and it starts working again (restarting soapUI doesn't help). I am using version 4.5.2. Here is the code I am using:. Here is the code I am using: engine = new JUnitReportEngine() listeners = testSuite.getTestSuiteRunListeners() fileResult = engine.createReport("C:\\Temp", listeners[0], runner.testSuite, engine.SINGLE_PAGE_PRINT_REPORT_FORMAT) String fileContents = new File("C:\\Temp\\index.html").text message = fileContents11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes1CommentRe: Test suite report via groovy
By "Normally we don't provide support for groovy scripts", do you mean for any of your java librarys? In my opinion this is about how soap specific methods work and not about groovy as a language. I'm doing context.collector = new JUnitReportCollector(11) testSuite.addTestSuiteRunListener(context.collector) in the setup and log.info(context.collector.getReport()) in the teardown. I get a string of "No reports..:". What venue would you recommend I discuss these problems on?11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes0CommentsTest suite report via groovy
I have a teardown script right now that grabs the status of the test suite and sends out an email with it. I would like to expand on this by putting an HTML summary of this suite in the body of the email. The HTML summary would be of the type that SoapUI generates (as in I do not want to iterate through my test cases, check status, and build html myself). Is there a way to access SoapUI's reporting capabilities from groovy? I have tried putting import com.eviware.soapui.report.JUnitReportCollector context.collector = JUnitReportCollector.createNew(11) in the Setup and then accessing it from the teardown. This gives me a nice looking empty SoapUI report on disk. Obviously I don't want it to be empty, and I would prefer to just have the report as a groovy object I can toString() and put in the body (instead of writing the report to disk, then reading the file, shoving it into the email, then deleting the file). Thank you for your help!11 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.4KViews0likes4Comments