Forum Discussion

anu's avatar
anu
Occasional Contributor
16 years ago

Running a Test Case from groovy script

Hi Ole

I want to run a test case. For that I have coded the following. But, I get compilation error. Can you pl. help me

testRunner.getTestCase().getTestStepByName("Step getSessionid").run(testRunner, context);
       
println("Finished Executing:");
        List stepResult=testRunner.getResults()
    Iterator j=stepResult.iterator();
    while (j.hasNext())
  {
      TestStepResult result=(TestStepResult)j.next();
      println("result:"+result.getStatus())
  }

The error is in "TestStepResult result=(TestStepResult)j.next();"

Also can you explain me why is testrunner being passed as parameter in the run method?

Thanks
Anu

1 Reply

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Anu,

    just to make sure; you are running a TestStep, not a TestCase here..

    Can you show the actual compilation error so I can get a better understanding?

    If you want to know why the testRunner is being passed as an argument to the TestStep.run method, I kindly ask you to have a look at the source-code, you will see how it is used :-)

    regards!

    /Ole
    eviware.com