Question regarding testing for execution time

  • benjamin

    benjamin - 2008-01-04


    I started evaluating sqlunit-5.0, really a highly valuable tool as I can see so far.

    However, I've got a question regarding testing for execution time of statements, it appears to me I can only specify expected execution time and a tolerance range for the expected value, so if the execution time is below the specified value including tolerance, tests will report a failure, while I'd like them to succeed in that case.

    To be precise, I have a situation where I want to ensure that a certain procedure call doesnt take longer than x milliseconds, everything below this value should be considered success, while any value above should be considered failure.

    Is there any way to specify this, or do I have to make changes to sqlunit code to accomplish this, and if so, can someone point me to where I need to look in the code?


    • Sujit Pal

      Sujit Pal - 2008-01-05

      Its been a while since I looked at the code, but to do this, you can look at the handler for the element where the expected duration and tolerance are specified.

      Another way to do this (without changing the code) would be as follows:
      Lets say you want your procedure to execute within 100ms, would it make sense to specify that the duration=0 and tolerance=100? Not sure if there are checks for negative duration, but if not, this should do the trick.


    • benjamin

      benjamin - 2008-01-07

      Hello Sujit,

      thanks for your suggestion, it indeed worked without a code change when specifying half the expected time I wanted to test for with a 100% tolerance.

      So, for checking if a procedure finishes within 100ms, I would set expected=50 and tolerance=100.

      Thanks a lot,


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks