Forum Discussion

Alcatel-Lucent__10's avatar
Alcatel-Lucent__10
Occasional Contributor
15 years ago

Exit loadtest from setup script

I have created a setup script for my loadtest which is reading some config from a config file.
In case of missing values, I want to exit my loadtest.

I have tried the following :

1. throw new Exception("blabla")
This exits the setup script, but the loadtest continues.

2. loadTestRunner.fail("blabla")
The loadtest is still executed.

Does anybode have an idea how I can just cancel the load test ?

1 Reply

  • Hello,

    calling loadTestrunner.fail in the startup script doesn't work since the test hasn't actually started yet, but it should and I have reported it as a bug, so hopefully this will be fixed soon. In the meantime, you can use this workaround:


    //LoadTest Setup script:
    context['shouldFail'] = true


    //TestCase Setup script:
    if( context.LoadTestContext['shouldFail'] ) {
    context.LoadTestRunner.fail('Reason')
    }


    Regards,
    Dain
    eviware.com