org.openqa.grid.internal.listeners
Interface TestSessionListener

All Known Implementing Classes:
DefaultRemoteProxy, SeleniumRemoteProxy, WebDriverRemoteProxy

public interface TestSessionListener

To be implemented by a class extending RemoteProxy.

WARNING : the before and after are executed by the proxy on the remote, and the action taken in those method are not isolated, and can have consequences on other sessions.

If some changes are made that can impact all running tests, the before / after implementation should take care of checking that no test are currently running to avoid collateral damages

For the case when a single remote handles multiple test sessions ( typical web driver ) using before / after will impact ALL the tests on that remote.


Method Summary
 void afterSession(TestSession session)
          Will be run after the last command is forwarded, but before the proxy slot is released.
 void beforeSession(TestSession session)
          Will be run after the proxy slot is reserved for the test, but before the first command is forwarded to the remote.
 

Method Detail

beforeSession

void beforeSession(TestSession session)
Will be run after the proxy slot is reserved for the test, but before the first command is forwarded to the remote.

Gives a chance to do a setup on the remote before the test start.

WARNING : beforeSession should NOT throw exception. If an exception is thrown, the session is considered invalid and the resources will be freed.

Parameters:
session -
See Also:
if the setup applies to all the tests.

afterSession

void afterSession(TestSession session)
Will be run after the last command is forwarded, but before the proxy slot is released.

If the test crashes before a session is provided by the remote, session.externalKey will be null.

WARNING : after session should NOT throw exception. If an exception is thrown, the resources will NOT be released, as it could mean the remote is now corrupted.



Copyright © 2011. All Rights Reserved.