com.atlassian.webdriver.testing.rule
Class TestedProductRule<T extends TestedProduct<WebDriverTester>>

java.lang.Object
  extended by com.atlassian.webdriver.testing.rule.TestedProductRule<T>
All Implemented Interfaces:
TestedProduct<WebDriverTester>, org.junit.rules.TestRule

public class TestedProductRule<T extends TestedProduct<WebDriverTester>>
extends Object
implements org.junit.rules.TestRule, TestedProduct<WebDriverTester>

Creates a TestedProductRule which acts just like a TestedProduct. Allows setting the rule up in a test instead of having to define a TestedProduct in an @BeforeClass or @Before rule. @Rule public TestedProductRule product = new TestedProductRule(YourTestedProduct.class);

Since:
2.1.0
See Also:
InjectionRules, ProductContextRunner

Constructor Summary
TestedProductRule(Class<T> testedProductClass)
           
 
Method Summary
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
           
 PageBinder getPageBinder()
           
 ProductInstance getProductInstance()
           
 T getTestedProduct()
           
 WebDriverTester getTester()
           
<P extends Page>
P
visit(Class<P> pageClass, Object... args)
          Constructs the page object, changes the browser URL to the desired page URL, then binds the object to the page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestedProductRule

public TestedProductRule(Class<T> testedProductClass)
Method Detail

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
                                               org.junit.runner.Description description)
Specified by:
apply in interface org.junit.rules.TestRule

visit

public <P extends Page> P visit(Class<P> pageClass,
                                Object... args)
Description copied from interface: TestedProduct
Constructs the page object, changes the browser URL to the desired page URL, then binds the object to the page.

Specified by:
visit in interface TestedProduct<WebDriverTester>
Type Parameters:
P - The page type
Parameters:
pageClass - The page class
args - Arguments to pass to the page object constructor.
Returns:
The constructed and fully loaded page with the browser set accordingly

getPageBinder

public PageBinder getPageBinder()
Specified by:
getPageBinder in interface TestedProduct<WebDriverTester>
Returns:
The page binder for visiting pages and binding page objects

getProductInstance

public ProductInstance getProductInstance()
Specified by:
getProductInstance in interface TestedProduct<WebDriverTester>
Returns:
Information about the instance being tested

getTester

public WebDriverTester getTester()
Specified by:
getTester in interface TestedProduct<WebDriverTester>
Returns:
The tester being used

getTestedProduct

public T getTestedProduct()


Copyright © 2014 Atlassian. All rights reserved.