Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.StepExecutionException


  }

    public static String evalScriptExpression(final Context context, final String expression, final Step step) {
        final ResetScriptRunner runner = context.getRunner();
        if (runner == null) {
            throw new StepExecutionException("Can't evaluate script property because no previous <scriptStep> with keep=true.", step);
        }
        runner.reset();
        try {
            return evalByRunner(runner, expression, step);
        } catch (BuildException be) {
            throw new StepExecutionException("Error invoking script: " + be.getMessage(), step);
        }
    }
View Full Code Here


            shell.evaluate(script);
    }
    catch (final CompilationFailedException e)
    {
      LOG.error("CompilationFailedException", e);
      throw new StepExecutionException("Cannot compile groovy code: " + script, step, e);
    }
        catch (final AssertionError e) {
            LOG.info("AssertionError", e);
            throw new StepFailedException("Assertion failed within groovy code: " + script, step);
        }
        catch (final RuntimeException e)
    {
      LOG.error("RuntimeException", e);
            throw new StepExecutionException("Error invoking groovy: " + e.getMessage(), step, e);
    }
    finally
    {
      out.flush();
    }
View Full Code Here

    }

    protected void verifyParameters() {
        super.verifyParameters();
        if (getSheetIndex() == null && getSheetName() == null) {
            throw new StepExecutionException("Either sheet number or sheet name should be specified", this);
        }
        if (getSheetIndex() != null && getSheetName() != null) {
            throw new StepExecutionException("One of sheet number or sheet name must be specified", this);
        }
    }
View Full Code Here

    }

    protected void verifyParameters() {
        super.verifyParameters();
        if (getCell() == null && (getRow() == null || getCol() == null)) {
            throw new StepExecutionException("You must specify a row and column or a cell reference.", this);
        }
        if (getCell() != null && (getRow() != null || getCol() != null)) {
            throw new StepExecutionException("You must specify either a row and column or a cell reference.", this);
        }
    }
View Full Code Here

    }

    protected HSSFSheet getExcelSheet() {
        final int numberOfSheets = getExcelWorkbook().getNumberOfSheets();
        if (numberOfSheets == 0) {
            throw new StepExecutionException("This spreadsheet has no sheets", this);
        }
        HSSFSheet sheet = null;
        if (fSheetName != null) {
            sheet = getExcelWorkbook().getSheet(fSheetName);
            if (sheet == null) {
                throw new StepExecutionException("A sheet named '"+ fSheetName + "' was not found in the file.", this);
            }
        }
        if (sheet == null && fSheetIndex != null) {
            final int sheetIndex = Integer.parseInt(fSheetIndex);
            if (sheetIndex < 0 || sheetIndex >= numberOfSheets) {
                throw new StepExecutionException("Invalid sheet index: "+fSheetIndex + ". This workbook contains sheets with indexes from 0 to "+ (numberOfSheets-1) + ".", this);
            }
            sheet = getExcelWorkbook().getSheetAt(sheetIndex);
        }
        if (sheet == null) {
            sheet = (HSSFSheet) getContext().get(KEY_CURRENT_SHEET);
View Full Code Here

        nullResponseCheck();
      final Page page = getContext().getCurrentResponse();
      if (page instanceof PDFPage)
        return (PDFPage) page;
     
      throw new StepExecutionException("Current response is not a PDF page but has following mime type "
          + page.getWebResponse().getContentType() + " (" + page + ")", this);
    }
View Full Code Here

    static HtmlElement findElementById(final Page currentResp, final String id,
                                       final Logger log, final Step step) throws StepFailedException {
        log.debug("Looking for element with id \"" + id + "\"");
        try {
            if (!(currentResp instanceof HtmlPage)) {
                throw new StepExecutionException("Current response is not an HTML page but of type "
                    + currentResp.getWebResponse().getContentType(), step);
            }
            HtmlPage lastHtmlResp = (HtmlPage) currentResp;
            final HtmlElement element = lastHtmlResp.getHtmlElementById(id);
            log.debug("found element with id \"" + id + "\": " + element);
View Full Code Here

            return new HSSFWorkbook(excelFile);
        }
        catch (final Exception e) {
            final String message = "Could not open Excel file.";
            LOG.debug(message, e);
            throw new StepExecutionException(message, this, e);
        } finally {
            IOUtils.closeQuietly(is);
        }
    }
View Full Code Here

        nullResponseCheck();
        final Page currentResponse = getContext().getCurrentResponse();

        String contentType = currentResponse.getWebResponse().getContentType();
        if (!MimeMap.EXCEL_MIME_TYPE.equals(contentType)) {
            throw new StepExecutionException("File does not have correct content type (not a '.xls' file?): "
                    + currentResponse.getWebResponse().getContentType(), this);
        }
    }
View Full Code Here

            final StringBuffer msg = new StringBuffer();
            msg.append("Test ").append(fScenario).append(" failed. Exit value: ").append(exitValue);

            final String s = msg.toString();
            LOG.error(s);
            throw new StepExecutionException(s, this);
        }
        AppletPluginResults apr = readResults(appletPluginArguments);

        verifyAppletResult(apr);
View Full Code Here

TOP

Related Classes of com.canoo.webtest.engine.StepExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.