use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class StubTestClass method testWithExceptionAndMaxRetryIncreased.
/**
* Increase max retry
*/
@Test(groups = "stub")
public void testWithExceptionAndMaxRetryIncreased() {
count++;
TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
step1.addAction(new TestAction("click button", false, new ArrayList<>()));
TestStepManager.logTestStep(step1);
try {
throw new DriverExceptions("some exception");
} finally {
if (count < 3) {
increaseMaxRetry();
}
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class StubTestClass method testWithExceptionAndDataProvider.
@Test(groups = "stub", dataProvider = "data")
public void testWithExceptionAndDataProvider(String data) {
count++;
TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
step1.addAction(new TestAction("click button", false, new ArrayList<>()));
TestStepManager.logTestStep(step1);
throw new DriverExceptions("some exception");
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class StubTestClassForEncoding method testWithException.
@Test(groups = "stub")
public void testWithException() {
TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), true);
step1.addAction(new TestAction("click button", false, new ArrayList<>()));
TestStepManager.logTestStep(step1);
throw new DriverExceptions("& some exception \"with \" <strong><a href='http://someurl/link' style='background-color: red;'>HTML to encode</a></strong>");
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class DriverExtractor method copyDriver.
public void copyDriver(String driverName) {
InputStream driver = Thread.currentThread().getContextClassLoader().getResourceAsStream(String.format("drivers/%s/%s%s", os, driverName, OSUtilityFactory.getInstance().getProgramExtension()));
if (driver == null) {
throw new DriverExceptions(String.format("Driver %s does not exist in resources", driverName));
}
Path driverPath = getDriverPath(driverName);
driverPath.toFile().getParentFile().mkdirs();
try {
Files.copy(driver, driverPath, StandardCopyOption.REPLACE_EXISTING);
if (!driverPath.toFile().setExecutable(true)) {
logger.warn(String.format("Driver %s could not be set to executable", driverPath));
}
logger.info(String.format("Driver %s copied to %s", driverName, driverPath));
} catch (IOException e) {
logger.info(String.format("Driver not copied: %s - it may be in use", driverName));
}
}
use of com.seleniumtests.customexception.DriverExceptions in project seleniumRobot by bhecquet.
the class StubTestClass method testWithException2.
/**
* An other test that throws exception
*/
@Test(groups = "stub", dependsOnMethods = "testAndSubActions")
public void testWithException2() {
TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
step1.addAction(new TestAction("click button", false, new ArrayList<>()));
TestStepManager.logTestStep(step1);
throw new DriverExceptions("some exception");
}
Aggregations