com.google.gwt.junit
Class RunStyle

java.lang.Object
  extended by com.google.gwt.junit.RunStyle
Direct Known Subclasses:
RunStyleHtmlUnit, RunStyleSelenium

public abstract class RunStyle
extends java.lang.Object

An abstract class that handles the details of launching a browser.


Constructor Summary
RunStyle(JUnitShell shell)
          Constructor for RunStyle.
 
Method Summary
 java.lang.String[] getInterruptedHosts()
          Tests whether the test was interrupted.
 java.lang.String getLocalHostName()
          Get the host name of the local system to use in URLs.
 int getTries()
          Returns the number of times this test should be tried to run.
abstract  int initialize(java.lang.String args)
          Initialize the runstyle with any supplied arguments, and return the number of clients this runstyle controls.
abstract  void launchModule(java.lang.String moduleName)
          Requests initial launch of the browser.
 void setTries(int tries)
          Sets the number of times a test should be tried -- it succeeds if any attempt succeeds.
 boolean setupMode(TreeLogger logger, boolean developmentMode)
          Setup this RunStyle for the selected mode.
 boolean shouldAutoGenerateResources()
          Whether the embedded server should ever generate resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunStyle

public RunStyle(JUnitShell shell)
Constructor for RunStyle. Any subclass must provide a constructor with the same signature since this will be how the RunStyle is created via reflection.

Parameters:
shell - the containing shell
Method Detail

getInterruptedHosts

public java.lang.String[] getInterruptedHosts()
Tests whether the test was interrupted.

Returns:
the interrupted hosts, or null if not interrupted

getLocalHostName

public java.lang.String getLocalHostName()
Get the host name of the local system to use in URLs. This method returns the host address instead of the host name in case the test target cannot resolve the host name.

Returns:
the host name of the local system

getTries

public int getTries()
Returns the number of times this test should be tried to run. A test succeeds if it succeeds even once.

Returns:
the number of attempts

initialize

public abstract int initialize(java.lang.String args)
Initialize the runstyle with any supplied arguments, and return the number of clients this runstyle controls.

Parameters:
args - arguments passed in -runStyle option, null if none supplied
Returns:
the number of clients, or -1 if initialization was unsuccessful

launchModule

public abstract void launchModule(java.lang.String moduleName)
                           throws UnableToCompleteException
Requests initial launch of the browser. This should only be called once per instance of RunStyle.

Parameters:
moduleName - the module to run
Throws:
UnableToCompleteException

setTries

public void setTries(int tries)
Sets the number of times a test should be tried -- it succeeds if any attempt succeeds.

Parameters:
tries - number of attempts

setupMode

public boolean setupMode(TreeLogger logger,
                         boolean developmentMode)
Setup this RunStyle for the selected mode.

Parameters:
logger - TreeLogger to use for any messages
developmentMode - true if we are running in development mode rather that web/production mode
Returns:
false if we should abort processing due to an unsupported mode or an error setting up for that mode

shouldAutoGenerateResources

public boolean shouldAutoGenerateResources()
Whether the embedded server should ever generate resources. Development mode needs this, but not with -noserver.

Returns:
true if resources should be automatically generated by the server.