cancel
Showing results for 
Search instead for 
Did you mean: 

Loadtest teardown script not working

SOLVED
Highlighted
New Contributor

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 

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Loadtest teardown script not working

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)

 

View solution in original post

3 REPLIES 3
Highlighted
New Contributor

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  

Highlighted
Community Hero

Re: Loadtest teardown script not working

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)

 

View solution in original post

Highlighted
Community Hero

Re: Loadtest teardown script not working

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.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors