net.thucydides.core.annotations.TestCaseAnnotations Maven / Gradle / Ivy
package net.thucydides.core.annotations;
import org.openqa.selenium.WebDriver;
/**
* Utility class used to inject fields into a test case.
* @author johnsmart
*
*/
public final class TestCaseAnnotations {
private final Object testCase;
private TestCaseAnnotations(final Object testCase) {
this.testCase = testCase;
}
public static TestCaseAnnotations forTestCase(final Object testCase) {
return new TestCaseAnnotations(testCase);
}
/**
* Instantiate the @Managed-annotated WebDriver instance with current WebDriver.
*/
public void injectDriver(final WebDriver driver) {
ManagedWebDriverAnnotatedField webDriverField = ManagedWebDriverAnnotatedField
.findFirstAnnotatedField(testCase.getClass());
webDriverField.setValue(testCase, driver);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy