Class Runner

    • Constructor Detail

      • Runner

        public Runner()
        Constructor.
    • Method Detail

      • setCommandLineArgs

        public void setCommandLineArgs​(String[] args)
        Set command line arguments.
        Parameters:
        args - command line arguments.
      • getCurrentTestCase

        public TestCase getCurrentTestCase()
        Description copied from interface: Context
        Get current test-case.
        Specified by:
        getCurrentTestCase in interface Context
        Returns:
        current test-case.
      • setCurrentTestCase

        public void setCurrentTestCase​(TestCase currentTestCase)
        Description copied from interface: Context
        Set current test-case.
        Specified by:
        setCurrentTestCase in interface Context
        Parameters:
        currentTestCase - current test-case.
      • setPrintStream

        public void setPrintStream​(PrintStream ps)
        Set PrintStream for logging.
        Parameters:
        ps - PrintStream for logging.
      • getPrintStream

        public PrintStream getPrintStream()
        Description copied from interface: Context
        Get PrintStream for logging.
        Specified by:
        getPrintStream in interface Context
        Returns:
        PrintStram object.
      • getTakesScreenshot

        protected org.openqa.selenium.TakesScreenshot getTakesScreenshot()
        Get TakesScreenshot instance.
        Returns:
        TakesScreenshot instance.
      • takeScreenshot

        protected String takeScreenshot​(File file,
                                        boolean entirePage)
                                 throws UnsupportedOperationException,
                                        org.openqa.selenium.WebDriverException
        Take screenshot.
        Parameters:
        file - file instance.
        entirePage - true if take screenshot of entire page.
        Returns:
        path of screenshot or null.
        Throws:
        UnsupportedOperationException - throw this exception if getTakesScreenshot() returns null.
        org.openqa.selenium.WebDriverException - throw this exception if it fails to get the screenshot.
      • normalizeScreenshotFilename

        protected File normalizeScreenshotFilename​(String filename)
        Normalize filename for screenshot.
        Parameters:
        filename - filename for screenshot.
        Returns:
        normalized file instance.
      • getFilenameForScreenshotAll

        protected File getFilenameForScreenshotAll​(String prefix,
                                                   int index)
        Get filename for screenshot all.
        Parameters:
        prefix - filename prefix.
        index - filename index.
        Returns:
        File instance for screenshot all.
      • getFilenameForScreenshotOnFail

        protected File getFilenameForScreenshotOnFail​(String prefix,
                                                      int index)
        Get filename for screenshot on fail.
        Parameters:
        prefix - filename prefix.
        index - filename index.
        Returns:
        File instance for screenshot on fail.
      • takeScreenshotAll

        public String takeScreenshotAll​(String prefix,
                                        int index)
        Description copied from interface: ScreenshotHandler
        Take screenshot at all commands if --screenshot-all option specified.
        Specified by:
        takeScreenshotAll in interface ScreenshotHandler
        Parameters:
        prefix - prefix name.
        index - command index.
        Returns:
        screenshot image path.
      • takeScreenshotOnFail

        public String takeScreenshotOnFail​(String prefix,
                                           int index)
        Description copied from interface: ScreenshotHandler
        Take screenshot on fail commands if --screenshot-on-fail option specified.
        Specified by:
        takeScreenshotOnFail in interface ScreenshotHandler
        Parameters:
        prefix - prefix name.
        index - command index.
        Returns:
        screenshot image path.
      • getWrappedDriver

        public org.openqa.selenium.WebDriver getWrappedDriver()
        Specified by:
        getWrappedDriver in interface org.openqa.selenium.WrapsDriver
      • getInitialWindowHandle

        public String getInitialWindowHandle()
        Description copied from interface: Context
        Get initial window handle.
        Specified by:
        getInitialWindowHandle in interface Context
        Returns:
        window handle.
      • setDriver

        public void setDriver​(org.openqa.selenium.WebDriver driver)
        Set WebDriver.
        Parameters:
        driver - WebDriver.
      • prepareWebDriver

        public void prepareWebDriver()
        Description copied from interface: Context
        Prepare WebDriver.
        Specified by:
        prepareWebDriver in interface Context
      • setWebDriverPreparator

        public void setWebDriverPreparator​(WebDriverPreparator preparator)
        Set WebDriverPreparator.
        Parameters:
        preparator - WebDriverPreparator.
      • getBrowserName

        public String getBrowserName()
        Description copied from interface: Context
        Get browser name.
        Specified by:
        getBrowserName in interface Context
        Returns:
        browser name.
      • setScreenshotAllDir

        public void setScreenshotAllDir​(String screenshotAllDir)
                                 throws IllegalArgumentException
        Set directory for storing screenshots at all commands.
        Parameters:
        screenshotAllDir - directory.
        Throws:
        IllegalArgumentException - throws if screenshotAllDir is not directory.
      • setScreenshotOnFailDir

        public void setScreenshotOnFailDir​(String screenshotOnFailDir)
        Set directory for storing screenshot on fail.
        Parameters:
        screenshotOnFailDir - directory.
      • getCurrentBaseURL

        public String getCurrentBaseURL()
        Description copied from interface: Context
        Get current base URL.
        Specified by:
        getCurrentBaseURL in interface Context
        Returns:
        base URL.
      • setOverridingBaseURL

        public void setOverridingBaseURL​(String overridingBaseURL)
        Set URL for overriding test-case base URL.
        Parameters:
        overridingBaseURL - base URL.
      • getOverridingBaseURL

        public String getOverridingBaseURL()
        Description copied from interface: Context
        Get base URL for overriding test-case base URL.
        Specified by:
        getOverridingBaseURL in interface Context
        Returns:
        base URL.
      • setIgnoredScreenshotCommand

        public void setIgnoredScreenshotCommand​(boolean isIgnoredScreenshotCommand)
        Set ignore screenshot command flag.
        Parameters:
        isIgnoredScreenshotCommand - set true if you want to ignore "captureEntirePageScreenshot"
      • isHighlight

        public boolean isHighlight()
        Description copied from interface: HighlightHandler
        Get locator highlighting.
        Specified by:
        isHighlight in interface HighlightHandler
        Returns:
        true if use locator highlighting.
      • setHighlight

        public void setHighlight​(boolean isHighlight)
        Set locator highlighting.
        Parameters:
        isHighlight - true if use locator highlighting.
      • isInteractive

        public boolean isInteractive()
        Description copied from interface: Context
        Get interactive.
        Specified by:
        isInteractive in interface Context
        Returns:
        interactive.
      • isW3cAction

        public boolean isW3cAction()
        Description copied from interface: Context
        Is Action command W3C compatible?
        Specified by:
        isW3cAction in interface Context
        Returns:
        true if Action command is W3C compatible.
      • setW3cAction

        public void setW3cAction​(Boolean isW3cAction)
        Set W3C action compatibility.
        Parameters:
        isW3cAction - true if Action command is W3C compatible.
      • setScreenshotScrollTimeout

        public void setScreenshotScrollTimeout​(int timeout)
        Set screenshot scroll timeout.
        Parameters:
        timeout - timeout (ms)
      • setInteractive

        public void setInteractive​(boolean isInteractive)
        Set interactive.
        Parameters:
        isInteractive - true if Runner executes test step-by-step upon user key stroke.
      • getTimeout

        public int getTimeout()
        Description copied from interface: Context
        Get timeout for waiting. (ms)
        Specified by:
        getTimeout in interface Context
        Returns:
        timeout for waiting.
      • setTimeout

        public void setTimeout​(int timeout)
        Description copied from interface: Context
        Set timeout for waiting. (ms)
        Specified by:
        setTimeout in interface Context
        Parameters:
        timeout - for waiting.
      • resetRetries

        public void resetRetries()
        Description copied from interface: Context
        Reset number of actually used retries.
        Specified by:
        resetRetries in interface Context
      • incrementRetries

        public void incrementRetries()
        Description copied from interface: Context
        Increment number of actually used retries.
        Specified by:
        incrementRetries in interface Context
      • hasReachedMaxRetries

        public boolean hasReachedMaxRetries()
        Description copied from interface: Context
        True if number of actually used retries has reached maximum number of retries.
        Specified by:
        hasReachedMaxRetries in interface Context
        Returns:
        true if retries has reached max retries.
      • getRetries

        public int getRetries()
        Description copied from interface: Context
        Get number of actually used retries.
        Specified by:
        getRetries in interface Context
        Returns:
        number of actually used retries.
      • getMaxRetries

        public int getMaxRetries()
        Description copied from interface: Context
        Get maximum number of retries allowed for a given test.
        Specified by:
        getMaxRetries in interface Context
        Returns:
        the maximum number of retries allowed for a given test.
      • setMaxRetries

        public void setMaxRetries​(int maxRetries)
        Description copied from interface: Context
        Set the maximum number of retries allowed for a given test.
        Specified by:
        setMaxRetries in interface Context
        Parameters:
        maxRetries - the maximum number of retries allowed for a given test.
      • getInitialSpeed

        public long getInitialSpeed()
        Get initial speed at starting test-suite. (ms)
        Returns:
        initial speed.
      • setInitialSpeed

        public void setInitialSpeed​(long initialSpeed)
        Set initial speed at starting test-suite. (ms)
        Parameters:
        initialSpeed - initial speed.
      • resetSpeed

        public void resetSpeed()
        Description copied from interface: Context
        Reset speed as initial speed.
        Specified by:
        resetSpeed in interface Context
      • getSpeed

        public long getSpeed()
        Description copied from interface: Context
        Get speed for setSpeed command.
        Specified by:
        getSpeed in interface Context
        Returns:
        speed.
      • setSpeed

        public void setSpeed​(long speed)
        Description copied from interface: Context
        Set speed for setSpeed command.
        Specified by:
        setSpeed in interface Context
        Parameters:
        speed - speed.
      • waitSpeed

        public void waitSpeed()
        Description copied from interface: Context
        Wait according to speed setting.
        Specified by:
        waitSpeed in interface Context
      • getCommandFactory

        public CommandFactory getCommandFactory()
        Description copied from interface: Context
        Get CommandFactory instance.
        Specified by:
        getCommandFactory in interface Context
        Returns:
        CommandFactory instance.
      • pushCommandListIterator

        public void pushCommandListIterator​(CommandListIterator commandListIterator)
        Description copied from interface: Context
        Push CommandListIterator.
        Specified by:
        pushCommandListIterator in interface Context
        Parameters:
        commandListIterator - CommanListIterator.
      • popCommandListIterator

        public void popCommandListIterator()
        Description copied from interface: Context
        Pop CommandListIterator.
        Specified by:
        popCommandListIterator in interface Context
      • getVarsMap

        public VarsMap getVarsMap()
        Description copied from interface: Context
        Get variables map.
        Specified by:
        getVarsMap in interface Context
        Returns:
        VarsMap.
      • setVarsMap

        public void setVarsMap​(VarsMap varsMap)
        Set variables map used for this session.
        Parameters:
        varsMap - the evaluated variables (state) for the current context.
      • setTestCaseMap

        public void setTestCaseMap​(TestCaseMap testCaseMap)
        Description copied from interface: Context
        Set test-case map.
        Specified by:
        setTestCaseMap in interface Context
        Parameters:
        testCaseMap - test-case map.
      • getFlowControlState

        public <T extends FlowControlState> T getFlowControlState​(ICommand command)
        Description copied from interface: Context
        Get flow control state.
        Specified by:
        getFlowControlState in interface Context
        Type Parameters:
        T - the class implements FlowControlState.
        Parameters:
        command - flow control command.
        Returns:
        flow control state.
      • setFlowControlState

        public <T extends FlowControlState> void setFlowControlState​(ICommand command,
                                                                     T state)
        Description copied from interface: Context
        Set flow control state.
        Specified by:
        setFlowControlState in interface Context
        Type Parameters:
        T - the class implements FlowControlState.
        Parameters:
        command - flow control command.
        state - flow control state.
      • getRollupRules

        public RollupRules getRollupRules()
        Description copied from interface: Context
        Get rollup rules.
        Specified by:
        getRollupRules in interface Context
        Returns:
        RollupRules object.
      • getEval

        public Eval getEval()
        Description copied from interface: Context
        Get evaluater.
        Specified by:
        getEval in interface Context
        Returns:
        eval object.
      • setLatestPageInformation

        public void setLatestPageInformation​(PageInformation pageInformation)
        Description copied from interface: Context
        Set latest page information.
        Specified by:
        setLatestPageInformation in interface Context
        Parameters:
        pageInformation - page information.
      • getLogFilter

        public EnumSet<LogFilter> getLogFilter()
        Description copied from interface: Context
        Get list of disabled page information.
        Specified by:
        getLogFilter in interface Context
        Returns:
        list of disabled page information.
      • setCookieFilter

        public void setCookieFilter​(CookieFilter cookieFilter)
        Description copied from interface: Context
        Set cookie filter.
        Specified by:
        setCookieFilter in interface Context
        Parameters:
        cookieFilter - cookie filter.
      • getJSLibrary

        public JSLibrary getJSLibrary()
        Description copied from interface: Context
        Get JavaScript library handler.
        Specified by:
        getJSLibrary in interface Context
        Returns:
        JavaScript library handler.
      • setJSLibrary

        public void setJSLibrary​(JSLibrary jsLibrary)
        Description copied from interface: Context
        Set JavaScript library handler.
        Specified by:
        setJSLibrary in interface Context
        Parameters:
        jsLibrary - JavaScript library handler.
      • resetState

        public void resetState()
        Description copied from interface: Context
        Reset internal state.
        Specified by:
        resetState in interface Context
      • execute

        public Result execute​(Selenese selenese)
        Execute test-suite / test-case.
        Parameters:
        selenese - test-suite or test-case.
        Returns:
        result.
      • isTrue

        public boolean isTrue​(String expr)
        Description copied from interface: Context
        Get boolean value of expr.
        Specified by:
        isTrue in interface Context
        Parameters:
        expr - expression.
        Returns:
        cast from result of expr to Javascript Boolean.
      • run

        public Result run​(String... filenames)
        Run Selenese script files.
        Parameters:
        filenames - Selenese script filenames.
        Returns:
        result.
      • run

        public Result run​(String filename,
                          InputStream is)
        Run Selenese script from input stream.
        Parameters:
        filename - selenese script file. (not open. used for label or generating output filename)
        is - input stream of script file. (test-case or test-suite)
        Returns:
        result.
      • setJUnitResultDir

        public void setJUnitResultDir​(String dir)
        Initialize JUnitResult.
        Parameters:
        dir - JUnit result directory.
      • setHtmlResultDir

        public void setHtmlResultDir​(String dir)
        Initialize HTMLResult.
        Parameters:
        dir - HTML result directory.
      • finish

        public void finish()
        Finish test. generate index.html for HTML result.