Forum Discussion

felipexlr50's avatar
felipexlr50
New Contributor
6 years ago
Solved

Loadtest teardown script not working

Hi, I am tying to setup a teardown script in the load test to verify the test results, but the teardown script seems to not run after the loadtest, I tested with a log.info in the setup script and in the teardown, but just the log in the setup script are showning.

 

setup script:
log.info("test 1");
teardown script: log.info("test 2");

 

SoapUI version 5.4.0 community edition 

  • The script is run, but logging is disabled. For example, if your Teardown script is

     

    assert 1 == 2

    then after running the LoadTest, you will see the Assertion error in the Error Log.

     

    I checked the soapui.log, and I saw:

     

    2018-08-18 09:31:55,204 INFO  [log] test 1
    2018-08-18 09:31:55,204 INFO  [SoapUI] Disabling logs during loadtests
    2018-08-18 09:32:00,255 INFO  [SoapUI] Enabled logs after loadtests

    So it looks like logging is disabled after the Setup Script, and enabled again after the Teardown script.

     

    Looks like there's a UI option for it:

     

    File > Options > UI Settings > Do not disable the groovy log when running load tests
    (you will get logging on your TestSteps, which might impact performance)

    I checked the source, and the mechanism of disabling the log is:

    Logger.getLogger("groovy.log").setLevel(Level.OFF);

    So you could do this at the start of your Teardown script:

    log.setLevel (org.apache.log4j.Level.INFO)

     

3 Replies

  • JHunt's avatar
    JHunt
    Community Hero

    The script is run, but logging is disabled. For example, if your Teardown script is

     

    assert 1 == 2

    then after running the LoadTest, you will see the Assertion error in the Error Log.

     

    I checked the soapui.log, and I saw:

     

    2018-08-18 09:31:55,204 INFO  [log] test 1
    2018-08-18 09:31:55,204 INFO  [SoapUI] Disabling logs during loadtests
    2018-08-18 09:32:00,255 INFO  [SoapUI] Enabled logs after loadtests

    So it looks like logging is disabled after the Setup Script, and enabled again after the Teardown script.

     

    Looks like there's a UI option for it:

     

    File > Options > UI Settings > Do not disable the groovy log when running load tests
    (you will get logging on your TestSteps, which might impact performance)

    I checked the source, and the mechanism of disabling the log is:

    Logger.getLogger("groovy.log").setLevel(Level.OFF);

    So you could do this at the start of your Teardown script:

    log.setLevel (org.apache.log4j.Level.INFO)

     

    • JHunt's avatar
      JHunt
      Community Hero

      It is interesting that the SoapUI code enables the log again by setting the log level to DEBUG. But actually the default log level in SoapUI is INFO. So after you run a LoadTest for the first time with logging automatically disabled, your log level will have actually changed.

  • felipexlr50's avatar
    felipexlr50
    New Contributor

    Hi, I am tying to setup a teardown script in the load test to verify the test results, but the teardown script seems to not run after the loadtest, I tested with a log.info in the setup script and in the teardown, but just the log in the setup script are showning.

    setup script:
    log.info("test 1");

     

    teardown script:

    log.info("test 2");

     

    SoapUI version 5.4.0 community edition