Forum Discussion

lmcadory's avatar
lmcadory
Occasional Contributor
14 years ago

Running TestSteps

Hello,

I am trying to setup Rest Test Cases. The problem I am having is verifying Post request correctly. I need to run the Post test then run the Get Request step to pull the new response. The problem I am having is running a test step through Groovy. The testRunner.runTestStepByName( "nameofteststep" ) is giving me an error. I was wondering how do I run a test step from an assertion step?

If this as already been answered I sorry for the repeat question. If the thread exist can someone point me to it, thanks.
  • Finan's avatar
    Finan
    Frequent Contributor
    Try the following script (run from groovyTestStep):

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
    def testCase = testRunner.testCase;
    def testStep = testCase.getTestStepAt(0);
    //def testStep = testCase.getTestStepByName("Delay");
    //def testStep = testCase.testSteps["Delay"];
    testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
    testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
    testStep.run(testRunner, testStepContext);


    You can, of course, change the testStep = getTestStepAt(0) for one of the options that were placed as a comment.
    • ravibabu_it's avatar
      ravibabu_it
      Occasional Contributor

       

       

       

    • viveksanganna's avatar
      viveksanganna
      New Contributor

      I tried this approach and this worked for me too.

       

      def testStep = testRunner.testCase.testSuite.testCases["testCaseName"].testSteps["testStepName"];
      def testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
      testStep.run(testRunner,testStepContext);

  • lmcadory's avatar
    lmcadory
    Occasional Contributor
    Thank You.

    I will let you know if I still get an error cause of testRunner
  • lmcadory's avatar
    lmcadory
    Occasional Contributor
    I am getting the:

    No Such Property: testRunner for class: Script1 error.
  • Finan's avatar
    Finan
    Frequent Contributor
    From where are you running this code? (It is meant to be run from a groovy testStep)
  • lmcadory's avatar
    lmcadory
    Occasional Contributor
    I am creating this code within the Test Cases. It's apart of the assertion test.
  • Finan's avatar
    Finan
    Frequent Contributor
    Hmmm, that's strange, the screenshot shows that the testRunner variable is known at the testStep level:S

    Anyway, attached project is an example of the script, tested to be working in soapUI 3.6.1 (not pro).
    Can you run the groovy step from the example project to see if that works in your soapUI?
    • SOAPUICrazy's avatar
      SOAPUICrazy
      New Contributor

      Hi Finan,

       

      In SOAP UI 5.2.1 , by default each request is waiting for response and then it is executing the other.

       

      Actually we are trying to push the REST request continuously  for every 5 sec without waiting for response in sequential manner.

       

      Is there is any option to disable the REST response or to reduce the wait time?

       

      Thanks in Advance,

      Crazyuser

  • lmcadory's avatar
    lmcadory
    Occasional Contributor
    It worked, which confuses me. I'm actually running Soapui in an enclosed environment. Let me try this sample test case there and see if works.


    UPDATED:------------------

    So I tired the sample in the enclosed space and it worked. the only differences I can see with your script is mine is that you use "def" and ";" in your script I will add those to mine and see if it works.