Forum Discussion

Liberty_Informa's avatar
Liberty_Informa
Regular Contributor
14 years ago

Delay step

Hi Ole

May I know how can I add Delay step through project load script in all test cases?

Which API method that can be used for this purpose?

Thanks

5 Replies

  • Hi,

    hmm.. can you elaborate a little on why you want to do this?! Maybe there are other solutions to achieve what you need to..

    thanks!

    /Ole
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi Ole,

    Every day we fire all our test suits at a scheduled time on Development database.

    We encountered problems when all the services hit the database at a time in parallel.

    As a result, we introduced delay step before in each test case. Currently we use formula to denote time in milliseconds, something like:
    ${=${#Project#CaseDelay}*${#TestCase#CaseNumber} + ${#Project#SuiteDelay}*${#TestSuite#SuiteNumber}}

    however what we want to do is, when we load the project the Groovy script should add delay step in each test case and add some delay time in it, may be some constant time in milliseconds or using mix of constant and dynamic values of suite number and case number in the loop.

    Of course, the script will skip adding the delay step and delay time, provided that the delay step has been already added by last project load.

    I hope it gives you bit more idea of our intention. May be you could suggest completely a new solution.
  • Hi,

    well - one easy alternative is to add a TestRunListener.beforeRun Event Handler (in the Project window Events tab) and set it to

    def delay = ..calc delay value...
    Thread.sleep delay


    Does that make sense!?

    regards!

    /Ole
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi Ole,

    It was really a great alternative and very much easy! We tested on sample project and it works. We will let you know once we implement in actual projects.