Forum Discussion

AAichholzer's avatar
AAichholzer
Occasional Contributor
12 years ago

Setup and teardown scripts are not executed from commandline

Hi
I have some setup and teardown scripts on testcase level.
The are working if test is started from the gui.
But if i start the test from commandline, they are not executed.
I hope there is a solution because i need this to prepare the environment before the test starts with the pro and the free version of SoapUI

best regards

Horst
  • Hi Horst,

    both setup and tear down scripts for test cases should be run when using the command line runner. I just verified that it works in SoapUI 4.6.1, but it should also work in previous versions.

    Try to just print something in the startup script and check if you can see that output.
    log.info "testcase started"


    Let me know if you still have troubles.

    Regards,
    Anders
    SmartBear Sweden
  • AAichholzer's avatar
    AAichholzer
    Occasional Contributor
    Hi Anders

    I try to execute this script:
    if (com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.getProperty('TESTID').value == 'SoapUI'){com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties.setPropertyValue('TESTID','Soap"+TestID+"'+testCase.testSuite.name[0..2]+'_'+testCase.name[0..2])}

    but is is only executed if the testcase is started from the GUI

    If i try to write something to the log, it works......

    regards

    Horst
  • Hi Horst,

    The problem could be that your script is trying to access the global property TESTID, which might not be set when you're running SoapUI from the command line.

    This page describes the various command line arguments. Try using the -G flag as described there to pass global properties to the testrunner.

    Regards,
    Arian
    SmartBear Sweden