Forum Discussion

krogold's avatar
krogold
Regular Contributor
3 years ago

How to run a testSuite setupScript from a groovy step

Hello,

 

I'm trying to run a testSuite's setup script from a groovy step.

I manage to play testCases setup script through the testCase's runSetupScript method but I can't find if the equivalent exists at testSuite's level. As testSuite have setup and teardown scripts I think that it should be possible to do so ...

I tried the following

 

	testRunner.testCase.testSuite.project.testSuiteList.each
	{
		suite ->
                suite.runSetupScript(context, testRunner)
                ... // other code
        }

 

but it provokes an error

 

groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestSuitePro.runSetupScript() is applicable for argument types: (com.eviware.soapui.impl.wsdl.panels.support.MockTestRunContext...) values: [[ThreadIndex:0, log:Launch all available tests#423277805:INFO in Default, ...], ...] Possible solutions: runSetupScript(com.eviware.soapui.model.testsuite.TestSuiteRunContext, com.eviware.soapui.model.testsuite.TestSuiteRunner), getSetupScript(), setSetupScript(java.lang.String) error at line: 121

 

or I may use the wrong context and runner ? but my tesSuite is not executed on its own, just parsed for playing eligible tests (with particular tags)

 

Maybe my first approach is not optimized as I could play the testSuite with tags but how can I do it from a groovy step ?

 

2 Replies

  • krogold's avatar
    krogold
    Regular Contributor

    I tried with

    result = suite.run (context.getProperties(), async) 
    if (String.valueOf( result.status ) != "PASS")
    {
        msg = "unexpected failure during $tc_name processing"
        testRunner.fail(msg)
    }

    and it worked, finally

     

    I have juste one more problem : if I want to play only a specific TAG, how can I configure it ?

     

  • nmrao's avatar
    nmrao
    Champion Level 3
    Not sure of such use case.
    Setup script is run automatically when the suite is run.
    Am I missing something?