Clone test Step to test case using java in soap ui
Hi I am trying to clone all test steps in all test cases in a suite to a particular test case in the same project. I am reading the entire list of test cases and their steps in a suite, saving these steps in a list. Now i want to add or clone these steps to a specific test case . An ideas here on how to proceed now ?nmrao any champion advice ? WsdlProject project = new WsdlProject(path); // get a list of all test suites on the project List<TestSuite> suiteList = project.getTestSuiteList(); for (int i = 0; i < suiteList.size(); i++) { TestSuite suite = suiteList.get(i); String suiteName = suite.getName(); System.out.println("Test suite - " + suiteName + " , Enabled :" + !suite.isDisabled()); // empty List for all test steps from Test case List<com.eviware.soapui.model.testsuite.TestStep> tsToBeAdded = new ArrayList<TestStep>(); if (suiteName.equals("Sometestsuite")) { // read the test cases in each suite List<com.eviware.soapui.model.testsuite.TestCase> caseList = suite.getTestCaseList(); System.out.println("test cases in suite - " + caseList.size()); for (int k = 0; k < caseList.size(); k++) { com.eviware.soapui.model.testsuite.TestCase testCase = caseList.get(k); System.out .println("Test Case - " + testCase.getName() + " , Enabled :" + !testCase.isDisabled()); // dont pick up load test if (!testCase.getName().equals("LoadTest")) { if (!testCase.isDisabled()) { // find all test steps List<com.eviware.soapui.model.testsuite.TestStep> stepList = testCase.getTestStepList(); System.out.println("test steps in test case - " + stepList.size()); for (int j = 0; j < stepList.size(); j++) { com.eviware.soapui.model.testsuite.TestStep step = stepList.get(j); System.out.println("Test step added - " + step.getName() + " , Enabled :" + !step.isDisabled()); tsToBeAdded.add(step); } } } } // check if test step list not empty if (tsToBeAdded.size() > 0) { // add the steps to Load test test case com.eviware.soapui.model.testsuite.TestCase loadTestCase = suite.getTestCaseByName("LoadTest"); for (TestStep testStep : tsToBeAdded) { System.out.println("Test step List - " + testStep.getName()); //TODO - somehow clone or add these test steps to this test case } } } }1.4KViews0likes2CommentsGroovyUtils.projectPath differs depending on context?
I have a SoapUI project that runs fine from the GUI, but if I try to run the test case from Java, it seems that the project path that GroovyUtils returns is empty. In my Groovy script I have this code: groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) log.info groovyUtils.projectPath When I run this script in SoapUI, I get a full path to my project: Wed Oct 25 16:13:06 CDT 2017:INFO:C:\Users\me\Documents\project_folder But when I call the Test Case from Java, the global-groovy.log file has 2017-10-25 16:05:50,665 INFO [log] It seems to be that the project path is empty when run from Java. If that's the case, how can I fix this?Getting 500 when running a test step from Java
I have a test suite with one test case which has three test steps. I can run the first test step from SoapUI just fine, but when I load the project from a Java class, I see debug messages with an HTTP 500 and a strange connection IP. Then there's an IOException. Here's my code: WsdlProject project = new WsdlProject("Resources/SOAPService-soapui-project.xml"); WsdlTestCase testCase = project.getTestSuiteByName("TestSuite 1").getTestCaseByName("TestCase 1"); WsdlTestStep driver = testCase.getTestStepByName("Driver"); StringToObjectMap properties = new StringToObjectMap(); properties.put("requestBody", null); properties.put("expectedVendorCode", null); properties.put("expectedInternalCode", null); properties.put("currentTime", null); WsdlTestCaseRunner runner = new WsdlTestCaseRunner(testCase, properties); runner.runTestStep(driver); Here's the log and stack trace: [HttpClientSupport$SoapUIHttpClient] Attempt 1 to execute request [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: POST /web_services/services/specific_service HTTP/1.1 [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Receiving response: HTTP/1.1 500 Internal Server Error [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Connection 0.0.0.0:65124<->216.58.218.206:80 shut down [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Connection 0.0.0.0:65124<->216.58.218.206:80 closed java.io.IOException: Decompression of response failed at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport.getResponseBody(HttpMethodSupport.java:321) at com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods.ExtendedPostMethod.getResponseBody(ExtendedPostMethod.java:133) at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.<init>(BaseHttpResponse.java:92) at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.<init>(SinglePartHttpResponse.java:46) at com.eviware.soapui.impl.wsdl.submit.transports.http.support.attachments.WsdlSinglePartHttpResponse.<init>(WsdlSinglePartHttpResponse.java:40) at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.wsdlRequest(HttpPackagingResponseFilter.java:75) at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.afterAbstractHttpResponse(HttpPackagingResponseFilter.java:52) at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.afterRequest(AbstractRequestFilter.java:68) at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:295) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:127) at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(WsdlSubmit.java:80) at com.eviware.soapui.impl.wsdl.WsdlRequest.submit(WsdlRequest.java:242) at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.run(WsdlTestRequestStep.java:419) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStepByName(AbstractTestCaseRunner.java:224) at com.eviware.soapui.model.testsuite.TestCaseRunner$runTestStepByName.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at Script1.run(Script1.groovy:11) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:100) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:154) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:229) at futzing.SoapUIRunner.main(SoapUIRunner.java:32) What am I missing in the setup?1.2KViews0likes0CommentsIssue while Running SOAPUI xml from Java in a container like Jboss Server
I am trying to run the SOAP UI project xml from the Java end and that java project is a web application that has been deployed in Jboss server. The SOAPUI xml is running for the first time and report is generating but the server is getting hanged after that .. and also it is not allowing to do any successive run . I am closing the SOAPUI Thread also completely. Please find the code snippet which I have written for this. //SOAPUI xml file path set here runner.setProjectFile((String) detail.get("testcasepath")); runner.setOutputFolder(filePath + timeStamp); // Executing the xml and generating the report runner.setJUnitReport(true); runner.setPrintReport(true); try { LOGGER.error("Run Started"); runner.run(); } catch (Exception e1) { System.out.println("Execution failed due to : "); e1.printStackTrace(); } } // Need to shutdown all the threads invoked by each SoapUI TestSuite SoapUI.getThreadPool().shutdown(); try { SoapUI.getThreadPool().awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); } // Now to shutdown the monitor thread setup by SoapUI Thread[] tarray = new Thread[Thread.activeCount()]; Thread.enumerate(tarray); for (Thread t : tarray) { if (t instanceof SoapUIMultiThreadedHttpConnectionManager.IdleConnectionMonitorThread) { ((SoapUIMultiThreadedHttpConnectionManager.IdleConnectionMonitorThread) t) .shutdown(); } } // Finally Shutdown SoapUI itself. SoapUI.shutdown();2.7KViews0likes11Commentsgetting :Missing credentials error
below is the java code to fetch response, but getting:Missing credentials error ,Could you please advise Note also set${Authoritzation} in Header WsdlProject project = new WsdlProject("C:/Users/Desktop/soft/ssoapui-project.xml"); testSuite = project.getTestSuiteList(); caseList=testSuite.get(0).getTestCaseList(); for (TestCase testCase :caseList) { System.out.println("TestCases........." + testCase.getName()); testCase.setPropertyValue("username","rr"); StringToObjectMap properties = new StringToObjectMap(); properties.put("Authorization","Basic QUFBQldFUzQ0TkVBQ1dwaVlYSjBiMnhrYVFBQ"); List<TestStep> testSteps = testCase.getTestStepList(); WsdlTestCaseRunner wsdlTestCaseRunner = new WsdlTestCaseRunner((WsdlTestCase) testCase, properties); WsdlTestRunContext wsdlTestRunContext = wsdlTestCaseRunner.createContext(properties); wsdlTestCaseRunner.run();1.4KViews0likes3Commentssoapui setup script not executed when test case or test step run from java
Hi, When I try to run an individualtest case or a test step in a test suitefrom Java , The set up script for the test suite is not executed ! Any way to run this setup scrip explicitly ? or any other work around except having individual set upscripts for a test case ?4.4KViews0likes8CommentsSoapUI Java API sending simple Http POST
Hi, I'm using Soap UI java API for some basic functionality, such as sending soap requests and running a wsdl mock service. Now however I want to simply create a default project; a test suite; a test case and a http request test step. But I can't find out how to go about this using the Java API. Since I have no wsdl I only want to maka a simple HTTP POST call. Setting this up in SoapUI gui, no problems but I don't get which java methods to use when doing this programmatically. Can anyone give me a pointer, or two? Thanks in advance! // Nisse BakkerudSolved4.5KViews0likes3CommentsHow to resolve the error “java.lang.Exception: TestCase [TestCase] failed without assertions"
Hi, Thanks in advance I am running soap ui testsuite it is working fine, I have created groovy and java in soapui assertion if timeout or service gives any error it will send email alert, while running the testsuite it is sending mail if the service is giving any error or read timeout. But I am trying same thing through “Launch TestRunner” it is not working and giving below mentioned errors. Please help to resolve this issue soapui project has been attached. Error: Running SoapUI TestRunner for [CustomerService-Testing] directory: C:\Program Files\SmartBear\SoapUI-5.0.0\bin\. command: cmd.exe /C testrunner.bat -sCustomerServiceTestSuite -cCustomerServiceTestCase C:\Users\sairam\Desktop\Testingjobs\CustomerService-Testing-soapui-project.xml SoapUI 5.0.0 TestCase Runner Configuring log4j from [C:\Program Files\SmartBear\SoapUI-5.0.0\bin\soapui-log4j.xml] 21:55:19,709 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\sairam\soapui-settings.xml] 21:55:22,805 INFO [WsdlProject] Loaded project from [file:/C:/Users/sairam/Desktop/Testingjobs/CustomerService-Testing-soapui-project.xml] 21:55:24,552 INFO [SoapUITestCaseRunner] Running SoapUI tests in project [CustomerService-Testing] 21:55:24,553 INFO [SoapUITestCaseRunner] Running TestCase [CustomerServiceTestCase] 21:55:24,581 INFO [SoapUITestCaseRunner] Running SoapUI testcase [CustomerServiceTestCase] 21:55:24,605 INFO [SoapUITestCaseRunner] running step [Test Request] 21:55:25,117 ERROR [WsdlSubmit] Exception in request: java.net.SocketTimeoutException: Read timed out 21:55:25,118 ERROR [SoapUI] An error occurred [Read timed out], see error log for details 21:55:25,146 INFO [SoapUITestCaseRunner] Assertion [SOAP Response] has status UNKNOWN 21:55:25,147 INFO [SoapUITestCaseRunner] Assertion [Schema Compliance] has status UNKNOWN 21:55:25,147 INFO [SoapUITestCaseRunner] Assertion [Not SOAP Fault] has status UNKNOWN 21:55:25,147 INFO [SoapUITestCaseRunner] Assertion [Script Assertion] has status UNKNOWN 21:55:25,148 ERROR [SoapUITestCaseRunner] Test Request failed, exporting to [C:\Program Files\SmartBear\SoapUI-5.0.0\bin\CustomerServiceTestSuite-CustomerServiceTestCase-Test_Request-0-FAILED.txt] 21:55:25,150 ERROR [SoapUITestCaseRunner] Error saving failed result: java.io.FileNotFoundException: C:\Program Files\SmartBear\SoapUI-5.0.0\bin\CustomerServiceTestSuite-CustomerServiceTestCase-Test_Request-0-FAILED.txt (Access is denied) java.io.FileNotFoundException: C:\Program Files\SmartBear\SoapUI-5.0.0\bin\CustomerServiceTestSuite-CustomerServiceTestCase-Test_Request-0-FAILED.txt (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.PrintWriter.<init>(Unknown Source) at com.eviware.soapui.tools.SoapUITestCaseRunner.afterStep(SoapUITestCaseRunner.java:725) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:251) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:52) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:152) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:47) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:81) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:645) at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:602) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:399) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:162) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:93) at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:119) 21:55:25,154 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [CustomerServiceTestCase], time taken: 517ms, status: FAILED 21:55:25,155 INFO [SoapUITestCaseRunner] TestCase [CustomerServiceTestCase] finished with status [FAILED] in 517ms 21:55:25,155 ERROR [SoapUITestCaseRunner] java.lang.Exception: TestCase [CustomerServiceTestCase] failed without assertions 21:55:25,156 ERROR [SoapUI] An error occurred [TestCase [CustomerServiceTestCase] failed without assertions ], see error log for details java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149) at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:110) at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:264) at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247) at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219) at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doReceiveResponse(HttpClientSupport.java:147) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:633) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:247) at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:362) at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:324) at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:237) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:127) at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(WsdlSubmit.java:80) at com.eviware.soapui.impl.wsdl.WsdlRequest.submit(WsdlRequest.java:242) at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.run(WsdlTestRequestStep.java:419) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:52) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:152) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:47) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:81) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:645) at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:602) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:399) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:162) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:93) at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:119) java.lang.Exception: TestCase [CustomerServiceTestCase] failed without assertions at com.eviware.soapui.tools.SoapUITestCaseRunner.throwFailureException(SoapUITestCaseRunner.java:535) at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:437) at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:162) at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:93) at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:119)6.3KViews0likes1Comment