Forum Discussion

jsc's avatar
jsc
Regular Contributor
14 years ago

kill mechanism to end not finishing testitems

Hi all,



as my test sometimes runs into some sort of endless loop (like waiting for an object that will not appear, because of broken software), that could just be stopped manually, I want to fix this bug in my scripts and improve my test-framework, so that similar bugs (that I do not know yet) would not have such big consequences. (currently the test has to be manually stopped and the items afterwards will not be executed)



First of all, I fixed the bug with the loop.



Now I want to add some sort of kill-mechanism to my framework, that kills executing the current testitem and moves on to the next item.

My idea is, that the trigger for this kill-mechanism would be the duration of the testitem as I do not know which future bugs can appear and I do not create testitems that take longer than ~10 minutes. So I would set a variable to the starting time at the start of each test and would check regularly the duration of the execution of the current testitem. If the duration exceeds 20 minutes I would kill the tested application and start over with the next testitem. (each testitem beginns with logging in to the tested application)



As I think, that you have way more experience than me and you for sure have encountered such problems, I want to hear your opinion, before I add this to my framework:

- Is there a better way to solve the problem of not finishing test items?

- Is there a better trigger for the kill-mechanism?

- General drawbacks of my approach?



This would help me a lot.



Best regards,



Joachim

5 Replies

  • jsc's avatar
    jsc
    Regular Contributor
    I just found the timeout property of the testitems (I did not use them till now)
  • jsc's avatar
    jsc
    Regular Contributor
    I created a small test project, consisting of 3 testitems:

    - item 1: just posting a Log.Warning

    - item 2: tryinig to initialize an object, that does not exist (so scripts (from script extensions) running in the background, trying to find it)

    - item 3: just posting a Log.Warning



    The settings for the project are:

    - timeout = 1 min

    - Stop on error = none

    - Stop on exception = none



    When I run this project, I get the following Exception, that I manually have to click, to make the execution move to the next testitem.





    In the log I get 2 error messages:

    1. The execution timeout has expired.

    2. The test execution was interrupted.         



    The first one is the error message thrown by the timeout event handler.

    The second one is from my script - I think because they are terminated while trying to initialize some



    How can I solve this problem, that I do not get the second error log entry and the exception popping up?

    My event handler is shown below.



    Kind regards,



    Joachim





    --------------------------------------------------------------------

    function GeneralEvents_OnTimeout(Sender, Params)

    {

      Params.Break = true;

    }
  • VLapidus's avatar
    VLapidus
    Frequent Contributor
    According to the exception message, something is wrong with your script extension. Check the script extensions for error in it and whether it is correctly installed.



    To avoid the second error in the log, create the OnStopTest event handler:



    Sub GeneralEvents_OnStopTest(Sender)

    Log.Enabled = False

    End Sub
  • jsc's avatar
    jsc
    Regular Contributor
    Hi,



    I do not know, what should be wrong with my script extensions.

    - there is no error (as far as I can see)

    - they are installed correctly



    The only thing about the extensions that is some kind of suspect to me is the following.



    When I type in a function call in a script extension file, that calls a function in another file then after I type the "." after the file-name, there is an error message pointing to a line, saying:

    - "log is undefined"

    - runtime error in microsoft jscript

    This has no real effect, after clicking 'ok' I can keep on calling each function I want. After re-installing script extensions, the same error occurs.



    At the corresponding line there is a simple "log.message("something").

    If I delete this line or put comments in front, then some other "log.message()" line in a completely different place is complained.



    Is this some known error? I really do not know, what this is..



    thanks a lot,



    Joachim



  • Hi Joachim,



    At the corresponding line there is a simple "log.message("something").
    Try using the correct case and let us know whether this helps:

    Log.Message("something")



    If this does not help, please contact us directly using the Contact Support form and send us your script extension so we can reproduce and investigate this issue.