Search in sources :

Example 1 with ScenarioLoaderException

use of org.asqatasun.scenarioloader.exception.ScenarioLoaderException in project Asqatasun by Asqatasun.

the class ScenarioLoaderImpl method run.

@Override
public void run() {
    try {
        LOGGER.debug("Launch Scenario " + scenario);
        FirefoxProfile firefoxProfile;
        if (isScenarioOnlyLoadPage(scenario)) {
            LOGGER.debug("Audit page script");
            firefoxProfile = profileFactory.getOnlineProfile();
        } else {
            LOGGER.debug("Scenario script, images are loaded and implicitly " + "wait timeout set");
            implicitelyWaitDriverTimeout = SCENARIO_IMPLICITELY_WAIT_TIMEOUT;
            firefoxProfile = profileFactory.getScenarioProfile();
        }
        Script script = getScriptFromScenario(scenario, firefoxProfile);
        try {
            if (script.run()) {
                LOGGER.debug(webResource.getURL() + " succeeded");
            } else {
                LOGGER.debug(webResource.getURL() + " failed");
            }
        } catch (TestRunException tre) {
            // The TestRunException is caught but not as runtime, to audit
            // at least pages already fetched
            LOGGER.warn(tre.getMessage());
        } catch (RuntimeException re) {
            LOGGER.warn(re.getMessage());
            throw new ScenarioLoaderException(re);
        }
        profileFactory.shutdownFirefoxProfile(firefoxProfile);
    } catch (IOException | JSONException | SuiteException ex) {
        LOGGER.warn(ex.getMessage());
        throw new ScenarioLoaderException(ex);
    }
}
Also used : Script(com.sebuilder.interpreter.Script) ScenarioLoaderException(org.asqatasun.scenarioloader.exception.ScenarioLoaderException) SuiteException(com.sebuilder.interpreter.factory.ScriptFactory.SuiteException) JSONException(org.json.JSONException) IOException(java.io.IOException) FirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile) TestRunException(org.asqatasun.sebuilder.interpreter.exception.TestRunException)

Aggregations

Script (com.sebuilder.interpreter.Script)1 SuiteException (com.sebuilder.interpreter.factory.ScriptFactory.SuiteException)1 IOException (java.io.IOException)1 ScenarioLoaderException (org.asqatasun.scenarioloader.exception.ScenarioLoaderException)1 TestRunException (org.asqatasun.sebuilder.interpreter.exception.TestRunException)1 JSONException (org.json.JSONException)1 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)1