Contributions
Re: calling fail() on LoadTestRunner hangs soapui
Marcus, you would't be able to run the project file as it relies heavily on web services on our app which you won't be able to access. I'll work on removing all the dependencies on our app and see if I can reproduce the result with a project I can send you. However, this will take a little time and with the upcoming U.S. holiday, it will probably be a couple weeks.11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.4KViews0likes0CommentsRe: calling fail() on LoadTestRunner hangs soapui
It's a 10 thread, simple strategy which is configured for 1 run per thread. Maybe I should try to explain our test (and our app) a bit more. Our app controls factory floors. Imagine you have a 10 step process to build a widget: Step 1 -> Step 2 -> Step 3 -> ... -> Step 10 and each steps adds a few more components on the widget until you have a completed widget after Step 10. The guy at Step 2 can't do anything until the guy at Step 1 hands him a partially completed widget. Our test is written so that each thread is acting as a user at a step (10 steps=10 users, therefore 10 threads). The test case we run first checks to see if there is a widget available to process and, if not, sleeps 100ms then checks again. If there is a widget ready to process, it adds a few bits to it, then checks to see if all widgets (we tell it to build 5 widgets) have finished that Step. If not, it goes back to the beginning of the test. If it is finished, the test case ends and that thread is finished. If, for example, something really bad happens at Step 2, I wanted to kill the whole load test. But calling fail() within the test case finished thread 2, but thread 3 (at step 3) is waiting for widgets from Step 2 and will never get them. So that thread is never cancelled and soapUI hangs.11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.4KViews0likes0CommentsRe: calling fail() on LoadTestRunner hangs soapui
Sometimes there are reasons for doing non-standard things. It would have been more helpful to try to address my question. I connected a debugger to soapUI and walked through the code. For others' benefit (and possibly my future self), here is the answer. First, the test case that was being run as a load test effectively was doing this: 1. start some work 2. complete some work 3. if work is not done, go to 1 What a call to fail() does is set all the other threads to CANCELLED status. This means when the thread finishes running the test case, it will stop. But in my poorly formed test above, the thread could never finish the test case because the "work" would never be done because the failed thread was terminated. While I'll admit the test is poorly written, I think soapUI ought to have a better mechanism to kill a load test. It's just not acceptable to hang the application.11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.4KViews0likes0Commentscalling fail() on LoadTestRunner hangs soapui
Using soapUI Pro 4.5.1 on Windows 7. I have the following groovy script test step within a test case. The intent is to stop the load test if any thread in the load test gets an error from our server during this particular soap request: def responseHeaderCode = testRunner.testCase.testSteps['Start'].testRequest.response.responseHeaders['#status#'] def code = responseHeaderCode.get(0).split(' ')[1] if (code != '200') { def responseString = testRunner.testCase.testSteps['Start'].testRequest.response.contentAsString log.error 'Thread['+context.ThreadIndex+'] Run['+context.RunCount+']: Start failed:' log.error '->'+responseString if (context.LoadTestContext != null) { context.LoadTestContext.loadTestRunner.fail('load test failed at Start - see logs') } } This script detects if the test case is being run within a load test and, if so, calls fail() on the LoadTestRunner. This causes an error dialog to pop-up in soapUI telling me the test failed (this is fine), but after clicking 'OK', soapUI is hung. I have no choice but to kill it via the Task Manager. Initially I tried calling "testRunner.fail('request failed')" but this seems to only fail the test case - the load test keeps running (less the thread that just failed). Am I doing something wrong? How do I stop the entire load test if one of the threads detects a failure? -tim11 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.7KViews0likes9CommentsRe: Run TestCase from Java and set Settings?
Right, but what I'm attempting to do is run a SoapUI test case from a junit/testng integration test, so I need to be able to call SoapUI classes from within my Java test code. That's easy enough, but my requirements are particular: 1. I need to be able to run the SoapUI test runner with specific SoapUI settings - namely, preemptive authentication needs to be true. 2. I need access to the run context of the test case after it has finished so I can fetch some properties that were set within the SoapUI test case and use them in my junit/testng integration test. The way the SoapUI code was written, those two requirements seem to be at odds with each other. You can either run a single TestCase and have access to the context, but not be able to set settings, or you can run a test case via the SoapUITestCaseRunner and set settings, but not have access to the finished TestCase context. I was able to use this method: WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); TestSuite testSuite = project.getTestSuiteByName( "Test Suite" ); TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" ); TestRunner runner = testCase.run( new PropertiesMap(), false ); which is from the online help. I can get the TestCase runtime context via this method, but I found no way to set SoapUI settings via these classes. So I wrote my own SoapUI test runner class which does the above but also instantiates the SoapUIPro.SoapUIProCore class within the constructor of my SoapUI test runner class. (I think the same would work for the non-Pro version using SoapUI.SoapUICore class.) So, effectively, I did this: SoapUIPro.SoapUIProCore soapuiCore = new SoapUIPro.SoapUIProCore(true, "/path/to/soapui-settings.xml"); WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); TestSuite testSuite = project.getTestSuiteByName( "Test Suite" ); TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" ); TestRunner runner = testCase.run( new PropertiesMap(), false ); This just seems really "hacky" and was unsure if it would cause other unintended consequences, which is why I was hoping for some feedback from SmartBear. -tim11 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.6KViews0likes4CommentsRe: Running _Pro_ TestCase via Java?
I got this working by doing this: SoapUIPro.SoapUIProCore soapuiCore = new SoapUIPro.SoapUIProCore(true, "src/test/resources/soapui-settings.xml", null); I'm not sure if that's the right way to get the soapui internals running Pro features.... Bonus: it lets me load settings also which basically answers my other question in the other thread. If this is the "right" way, I'll update that thread with whatever answer I hear back from SmartBear. -tim11 years agoPlace ReadyAPI QuestionsReadyAPI Questions736Views0likes0CommentsRunning _Pro_ TestCase via Java?
The online help shows an example of running a TestCase in Java: WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); TestSuite testSuite = project.getTestSuiteByName( "Test Suite" ); TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" ); // create empty properties and run synchronously TestRunner runner = testCase.run( new PropertiesMap(), false ); assertEquals( Status.FINISHED, runner.getStatus() ); However, my TestCase uses Datasources - a Pro feature - and when running this code the datasource entries are not resolved into my requests. I see in the Pro javadocs there is a WsdlProjectPro class, but just changing this was not enough. I don't see an equivalent Pro classes for TestSuite, TestCase, or TestRunner. How do I run this example on a soapui Pro TestCase? Note: I don't want to use SoapUIProTestCaseRunner because I need access to the TestCase context after the test has run. Thanks, -tim11 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.5KViews0likes2CommentsRun TestCase from Java and set Settings?
I have some experience writing Java which calls soapUI - we've written our own maven plugin which executes multiple projects, but... I need to be able to run a single TestCase, be able to search the resulting context for some parameters, but also be able to set preemptive authentication. How can I do this? The "Integrating with JUnit" section of the online help seems ideal for running a single TestCase and getting the resulting context, but I don't see how I can set soapUI Settings at that level - is there another way of setting preemptive authentication? When I run from the SoapUITestCaseRunner level, I can set the settings easily, but I don't see how I can get access to the TestCase's context after it has run. Help! -tim11 years agoPlace ReadyAPI QuestionsReadyAPI Questions5.7KViews0likes9Comments