Package com.xceptance.xlt.api.engine.scripting

# Class AbstractScriptTestCase

java.lang.Object
com.xceptance.xlt.api.tests.AbstractTestCase
com.xceptance.xlt.api.tests.AbstractWebDriverTestCase
com.xceptance.xlt.api.engine.scripting.AbstractScriptTestCase

public abstract class AbstractScriptTestCase extends AbstractWebDriverTestCase
The super class for all script-based test cases. Test case scripts are interpreted and the commands found therein will be executed using a `WebDriver` implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractScriptTestCase()`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `__cleanUpAbstractScriptTestCase()`
  Performs additional cleanup tasks for XML-based script test cases.
  `final void`
  `__setUpAbstractScriptTestCase()`
  Performs additional setup tasks for XML-based script test cases.
  `protected void`
  `executeScript(String scriptName)`
  Executes the test case script with the given name using any previously set `WebDriver` instance, test data set and base URL.
  `String`
  `getBaseUrl()`
  Returns the base URL to use when running the test script.
  `String`
  `getScriptName()`
  Returns the name of the test script to use.
  `void`
  `setBaseUrl(String baseUrl)`
  Sets the base URL to use when running the test script.
  `void`
  `setScriptName(String scriptName)`
  Sets the name of the test script to use.
  `void`
  `setWebDriver(WebDriver webDriver)`
  Sets the `WebDriver` instance to use for the test.
  `void`
  `test()`
  The one and only test method, which executes the configured script test case.

  ### Methods inherited from class com.xceptance.xlt.api.tests.AbstractWebDriverTestCase

  `__quitWebDriver, getWebDriver`

  ### Methods inherited from class com.xceptance.xlt.api.tests.AbstractTestCase

  `__setup, __tearDown, getEffectiveKey, getProperty, getProperty, getProperty, getProperty, getSimpleName, getTestDataSet, getTestName, reconfigureStartUrl, setTestDataSet, setTestName, setTestName, setUp, tearDown`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractScriptTestCase

    public AbstractScriptTestCase()
    Constructor.

- ## Method Details

  - ### getBaseUrl

    public String getBaseUrl()
    Returns the base URL to use when running the test script. All relative URLs in the script are resolved against this base URL.
    Returns:
      the base URL

  - ### getScriptName

    public String getScriptName()
    Returns the name of the test script to use.
    Returns:
      the script name

  - ### setBaseUrl

    public void setBaseUrl(String baseUrl)
    Sets the base URL to use when running the test script. All relative URLs in the script are resolved against this base URL.
    Parameters:
      `baseUrl` - the base URL

  - ### setScriptName

    public void setScriptName(String scriptName)
    Sets the name of the test script to use.
    Parameters:
      `scriptName` - the script name

  - ### setWebDriver

    public void setWebDriver(WebDriver webDriver)
    Sets the `WebDriver` instance to use for the test.

    Note that this method also sets the driver's implicit wait time-out to the value defined in the XLT configuration. If you want to run your driver with a different time-out value, set this value after calling this method:

         webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

    Note that when explicitly setting the driver instance via this method, you also have to close it by yourself.
    Overrides:
      `setWebDriver` in class `AbstractWebDriverTestCase`
    Parameters:
      `webDriver` - the web driver to use

  - ### test

    public void test() throws Exception
    The one and only test method, which executes the configured script test case.
    Throws:
      `Exception` - if an error occurs when executing the script

  - ### executeScript

    protected void executeScript(String scriptName) throws Exception
    Executes the test case script with the given name using any previously set `WebDriver` instance, test data set and base URL.
    Parameters:
      `scriptName` - the script name
    Throws:
      `Exception` - if an error occurred during script execution

  - ### __setUpAbstractScriptTestCase

    public final void __setUpAbstractScriptTestCase()
    Performs additional setup tasks for XML-based script test cases. Don't call this method directly, it will be called implicitly by the JUnit framework.

  - ### __cleanUpAbstractScriptTestCase

    public final void __cleanUpAbstractScriptTestCase()
    Performs additional cleanup tasks for XML-based script test cases. Don't call this method directly, it will be called implicitly by the JUnit framework.