Forum Discussion

srinivas_das_l's avatar
srinivas_das_l
Contributor
16 years ago

add testStep using testSuite teardown script ???

Hi All,

How to add testStep from testSuite teardown script using groovy???

E.g :

I have created a testSuite in soapUI .I need to add testStep to an existing testcase using  teardown script  present in testSuite.Can anyone suggest how it can be??

Regards,
Srinivas

9 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Srinivas,

    sure, what kind of teststep do you want to add?

    regards,

    /Ole
    eviware.com
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    please clarify the name of the interface and operation you want to create the request-step for.

    Thanks in advance!

    regards,

    /Ole
    eviware.com
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    ok.. please try the following:

    // get operation
    def op = testRunner.testCase.testSuite.project.interfaces["DiseAccountBinding"].operations["CreateAccount"]

    // create config
    def config = com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory.createConfig( op, "Name of Request" )

    // add to testcase
    testRunner.testCase.addTestStep( config )


    let me know how it works!

    regards,

    /Ole
    eviware.com
  • Hi Ole,

            wht u have written,absolutely working fine for  testcase level scripting i.e if we add a groovy script in testcase and execute it but My query is about testSuite
    In testSuite level how is the code??
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    oh.. sorry.. my mistake.. try

    // get operation
    def op = testSuite.project.interfaces["DiseAccountBinding"].operations["CreateAccount"]

    // create config
    def config = com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory.createConfig( op, "Name of Request" )

    // add to testcase
    def testCase = testSuite.testCases["Desired TestCase"].addTestStep( config )


    regards!

    /Ole
    eviware.com
  • Hi Ole,
                  I am getting the following error

    groovy.lang.MissingPropertyException: Exception evaluating property 'createAccount' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: createAccount for class: com.eviware.soapui.impl.wsdl.WsdlOperation
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    please show your entire script!

    regards,

    /Ole
    evwiare.com