Class UIAutomationTest<THost extends UIAutomationHost>

java.lang.Object
de.renebergelt.juitest.host.testscripts.UIAutomationTest<THost>
Type Parameters:
THost - Type of the UIAutomationHost which runs this test
Direct Known Subclasses:
SwingAutomationTest

public abstract class UIAutomationTest<THost extends UIAutomationHost> extends Object
Interface for automation tests
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Indicates if the cancellation of this test has been requested
    protected THost
    The Host of this UIAutomationTest
    protected AtomicReference<de.renebergelt.juitest.core.AutoResetEvent>
    The current wait event
    static de.renebergelt.juitest.core.Timeout
    The default timeout (1 minute)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Executed after a test has run
    void
    Executed before every tests
    void
    Cancel the execution of this script
    void
    log​(String message)
    Send teh given log message to the registered TestExucitionListener (if any)
    void
    pause​(String message)
    Pause test execution and signal to the test monitor that the current script has been paused.
    void
    Continue execution if this test has been paused
    void
    scriptAssert​(Supplier<Boolean> condition)
    Throws an AutomationException when the condition is not satisfied and thus aborts script execution
    void
    scriptAssert​(Supplier<Boolean> condition, String failureMessage)
    Throws an AutomationException with the given failureMessage when the condition is not satisfied and thus aborts script execution
    void
    setContext​(THost context)
    Sets the automation context
    void
    setExecutionListener​(de.renebergelt.juitest.core.services.TestExecutionListener executionListener)
    Set the execution listener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_TIMEOUT

      public static final de.renebergelt.juitest.core.Timeout DEFAULT_TIMEOUT
      The default timeout (1 minute)
    • cancellationRequested

      protected boolean cancellationRequested
      Indicates if the cancellation of this test has been requested
    • context

      protected THost extends UIAutomationHost context
      The Host of this UIAutomationTest
    • currentEvent

      protected AtomicReference<de.renebergelt.juitest.core.AutoResetEvent> currentEvent
      The current wait event
  • Constructor Details

    • UIAutomationTest

      public UIAutomationTest()
  • Method Details

    • setContext

      public void setContext(THost context)
      Sets the automation context
      Parameters:
      context - The automation context
    • setExecutionListener

      public void setExecutionListener(de.renebergelt.juitest.core.services.TestExecutionListener executionListener)
      Set the execution listener
      Parameters:
      executionListener - The execution listener instance to inform of the test execution state
    • resume

      public void resume()
      Continue execution if this test has been paused
    • pause

      public void pause(String message)
      Pause test execution and signal to the test monitor that the current script has been paused. test execution will continue once the test monitor sends the continue execution command Test will only be paused, if a TestExecutionListener has been set
      Parameters:
      message - A message to display to the user
    • cancel

      public void cancel()
      Cancel the execution of this script
    • log

      public void log(String message)
      Send teh given log message to the registered TestExucitionListener (if any)
      Parameters:
      message - The log message
    • scriptAssert

      public void scriptAssert(Supplier<Boolean> condition) throws de.renebergelt.juitest.core.exceptions.AutomationException
      Throws an AutomationException when the condition is not satisfied and thus aborts script execution
      Parameters:
      condition - The condition to check
      Throws:
      de.renebergelt.juitest.core.exceptions.AutomationException - Thrown, if the condition supplier returns false
    • scriptAssert

      public void scriptAssert(Supplier<Boolean> condition, String failureMessage) throws de.renebergelt.juitest.core.exceptions.AutomationException
      Throws an AutomationException with the given failureMessage when the condition is not satisfied and thus aborts script execution
      Parameters:
      condition - The condition to check
      failureMessage - The message to use for the AutomationException if the condition check failed
      Throws:
      de.renebergelt.juitest.core.exceptions.AutomationException - Thrown, if the condition supplier returns false
    • beforeTest

      public void beforeTest()
      Executed before every tests
    • afterTest

      public void afterTest()
      Executed after a test has run