@Override protected Object createTest() throws Exception { final Object test = super.createTest(); assertTrue("Test class must inherit WebTestCase", test instanceof WebTestCase); final WebTestCase object = (WebTestCase) test; object.setBrowserVersion(browserVersion_); if (test instanceof WebDriverTestCase) { ((WebDriverTestCase) test).setUseRealBrowser(realBrowser_); } return object; }
private void setAlerts(final WebTestCase testCase, final Method method) { final Alerts alerts = method.getAnnotation(Alerts.class); String[] expectedAlerts = {}; if (alerts != null) { if (isDefined(alerts.value())) { expectedAlerts = alerts.value(); } else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_6) { if (isDefined(alerts.IE6())) { expectedAlerts = alerts.IE6(); } else if (isDefined(alerts.IE())) { expectedAlerts = alerts.IE(); } } else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_7) { if (isDefined(alerts.IE7())) { expectedAlerts = alerts.IE7(); } else if (isDefined(alerts.IE())) { expectedAlerts = alerts.IE(); } } else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_8) { if (isDefined(alerts.IE8())) { expectedAlerts = alerts.IE8(); } else if (isDefined(alerts.IE())) { expectedAlerts = alerts.IE(); } } else if (browserVersion_ == BrowserVersion.FIREFOX_2) { if (isDefined(alerts.FF2())) { expectedAlerts = alerts.FF2(); } else if (isDefined(alerts.FF())) { expectedAlerts = alerts.FF(); } } else if (browserVersion_ == BrowserVersion.FIREFOX_3) { if (isDefined(alerts.FF3())) { expectedAlerts = alerts.FF3(); } else if (isDefined(alerts.FF())) { expectedAlerts = alerts.FF(); } } } testCase.setExpectedAlerts(expectedAlerts); }