close tests jvm hook

Help
Anonymous
2009-12-01
2012-09-15

  • Anonymous
    2009-12-01

    Hi

    I need to close the selenium, and to invoke logout when the scenario is ends.
    in my case it happens when the jsystem close the tests jvm (there one jvm for
    the whole scenario)

    is there is any suck hook ?

    Thanks

     
  • Yehudit Nadav
    Yehudit Nadav
    2009-12-02

    In 'jsystem.properties' file, set 'run.mode' property to '4'...

    The JRunner has three execution modes:

    • Drop every run(1) - The default run mode where one JVM is created for the whole scenario execution.
    • Drop every test(2) - A new JVM is created for each test.
    • Drop every scenario(4) - A new JVM is created for each sub scenario.
      Drop every test Mode was developed to perform very long test and scenario runs
      that can exhaust the test JVM

    and cause an execution failure, thus a new JVM is spawned for each test.

    As a result, when implementing 'Drop every test' special considerations must
    be made for extended

    running time as well as the fact that data cannot be shared using JVM heap
    space functionality.

    In order to relieve these two limitations 'Drop every scenario' was developed,
    in this run mode a JVM

    is allocated for each sub-scenario, so that tests in the same sub scenario can
    share the JVM

    heap space and execution, greatly increasing test execution speed.

    Default Value = Drop every run

     

  • Anonymous
    2009-12-02

    Thanks Yehudit.

    I need hook for each time that the jsystem "kills" the tests jvm.

    without any relation to jsystem "run mode" value.

    the reason that I need it, is because I want to create automatically logout
    when the jsystem kill the selenium server and client, which happens when it
    kills the tests jvm.

    If we create scenario, we can add in the end of the scenario "logout" test
    that can do it. but the QA and R&D engineers use the jsystem and can create
    their own scenarios, without invoking the logout test.

    I want hook, which invokes the logout method before the jsystem kills the jvm
    tests. in such case the jsystem handles automatically the logout issue.

     
  • Use JAVA shutDownHook

    implement a thread class of your own.

    in your system object \test code add:

    Runtime.getRuntime().addShutdownHook(yourThread);