Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Scripting - Test Case Timing - Sleep to delay / wait

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Hey guys I think i'm running across some transaction timing issues with my test cases which may be causing some data corruption at my service endpoint. I've been toying around with the folder level test case logic features but I can't seem to get what I want.

Is there a way to put a pause in top to bottom execution per test case or per test suite?

Thanks,

LeapTester
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    LeapTester,

    For each delay that you want to occur between a test, you'll need to add a method tool that has the following content:
    CODE
    from soaptest.api import SOAPUtil
    def addDelay():
       SOAPUtil.sleep(3000)

    I've attached an example project that shows you how this can be done. For convenience, (if you have a lot of delays that need to be added), I've also shown in my example how to create a global tool so that the method tool needs to be created only once and then can be quickly added multiple times in your test suites. When you add the tool using the "right-click" menu, you'll choose "Existing" instead of "New Tool".

    -Mike
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Awesome!

    Thx again,

    -LT-
  • whaaker
    whaaker Posts: 59
    edited December 2020

    An alternative to using an Extension Tool that performs a wait, we also have wait options available in the Test Suite settings under Execution Options > Test Flow Logic. If your Test Suite's Test Execution Options are set to "Individually Runnable" instead of "Tests run as Group" (you can tell because 'Tests run as group' renames it from 'Test Suite' to 'Scenario') then you will want to uncheck the "Only apply for scenarios" check box for these delays to take effect.