Search in sources :

Example 1 with TestType

use of com.seleniumtests.driver.TestType in project seleniumRobot by bhecquet.

the class SeleniumTestsReporter2 method fillContextWithTestParams.

/**
 * Fill velocity context with test context
 * @param velocityContext
 */
private void fillContextWithTestParams(VelocityContext velocityContext, ITestResult testResult) {
    SeleniumTestsContext selTestContext = TestNGResultUtils.getSeleniumRobotTestContext(testResult);
    if (selTestContext != null) {
        String browser = selTestContext.getBrowser().getBrowserType();
        String app = selTestContext.getApp();
        String appPackage = selTestContext.getAppPackage();
        TestType testType = selTestContext.getTestType();
        if (browser != null) {
            browser = browser.replace("*", "");
        }
        String browserVersion = selTestContext.getWebBrowserVersion();
        if (browserVersion != null) {
            browser = browser + browserVersion;
        }
        velocityContext.put(APPLICATION, "");
        if (testType == null) {
            velocityContext.put(APPLICATION_TYPE, "Error in initialization");
        // Log URL for web test and app info for app test
        } else if (testType.family().equals(TestType.WEB)) {
            velocityContext.put(APPLICATION_TYPE, "Browser");
            velocityContext.put(APPLICATION, browser);
        } else if (testType.family().equals(TestType.APP)) {
            // Either app Or app package and app activity is specified to run test on app
            if (StringUtils.isNotBlank(appPackage)) {
                velocityContext.put(APPLICATION_TYPE, "App Package");
                velocityContext.put(APPLICATION, appPackage);
            } else if (StringUtils.isNotBlank(app)) {
                velocityContext.put(APPLICATION_TYPE, "App");
                velocityContext.put(APPLICATION, app);
            }
        } else if (testType.family().equals(TestType.NON_GUI)) {
            velocityContext.put(APPLICATION_TYPE, "");
        } else {
            velocityContext.put(APPLICATION_TYPE, "Invalid Test type");
        }
    }
}
Also used : SeleniumTestsContext(com.seleniumtests.core.SeleniumTestsContext) TestType(com.seleniumtests.driver.TestType)

Aggregations

SeleniumTestsContext (com.seleniumtests.core.SeleniumTestsContext)1 TestType (com.seleniumtests.driver.TestType)1