GrapheneConfiguration configuration = ...; GrapheneConfigurationContext.set(configuration); ... configuration = GrapheneConfigurationContext.get();
This section is targeting framework developers building on top of Graphene, rather than Graphene users.
Thread-Local Context is principle used across the framework as fundamental part simplifying development of Selenium tests.
Using contexts, test engineers can avoid complexity of test classes and evolve test to true object-oriented pieces sharing contexts using dependency injection and proxy patterns.
GrapheneConfiguration configuration = ...; GrapheneConfigurationContext.set(configuration); ... configuration = GrapheneConfigurationContext.get();
Using thread-local store for context makes use of the fact that Selenium tests are mostly not spread across several threads (with exception of several tests running in paralel).
Each developer using Graphene has to bear in mind that issues may occur when don't follow rule of using one thread for one test.
For convenience of notation, context does not need to be obtained by get() method, but context is able to construct proxy, which delegates all calls to contextual instances:
GrapheneSelenium selenium = GrapheneSelenium.getProxy(); ... // use contextual information to access selenium in current test selenium.click(button);