Package org.mozilla.zest.impl
Class ZestBasicRunner
- java.lang.Object
-
- org.mozilla.zest.impl.ZestBasicRunner
-
- All Implemented Interfaces:
ZestOutputWriter,ZestRunner,ZestRuntime
public class ZestBasicRunner extends Object implements ZestRunner, ZestRuntime
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classZestBasicRunner.Default
-
Constructor Summary
Constructors Constructor Description ZestBasicRunner()New Zest basic runner with default settings.ZestBasicRunner(Integer timeoutInSeconds, boolean skipSSLCertificateCheck)New Zest basic runner with custom settingsZestBasicRunner(ScriptEngineFactory factory)ZestBasicRunner(ScriptEngineFactory factory, ZestHttpClient httpclient)ZestBasicRunner(ZestHttpClient httpclient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWebDriver(String handle, org.openqa.selenium.WebDriver wd)Add a handle associated with a WebDrivervoiddebug(String str)Outputs the supplied message if debugging is turned onZestRequestgetLastRequest()Get the last request.ZestResponsegetLastResponse()Get the last response.StringgetProxy()Gets the proxy, as host:portScriptEngineFactorygetScriptEngineFactory()booleangetStopOnAssertFail()Gets the stop on assert fail.booleangetStopOnTestFail()Gets the stop on test fail.StringgetVariable(String name)Gets the variable.Map<String,String>getVariables()Gets the variables.org.openqa.selenium.WebDrivergetWebDriver(String handle)Get the WebDriver assicated with the handleList<org.openqa.selenium.WebDriver>getWebDrivers()Return all of the WebDriversStringhandleAction(ZestScript script, ZestAction action, ZestResponse lastResponse)Handle action.StringhandleAssignment(ZestScript script, ZestAssignment assign, ZestResponse lastResponse)Handle an assignment.StringhandleClient(ZestScript script, ZestClient client)voidhandleControlLoopBreak()voidhandleControlLoopNext()ZestResponsehandleLoop(ZestScript script, ZestLoop<?> loop, ZestResponse lastResponse)voidhandleResponse(ZestRequest request, ZestResponse response)Handle response.booleanisDebug()Reports if debugging is enabledvoidoutput(String str)Outputs the specified stringvoidremoveWebDriver(String handle)Remove a handle associated with a WebDriverStringreplaceVariablesInString(String str, boolean urlEncode)Replace any variables in the supplied stringvoidresponseFailed(ZestRequest request, ZestResponse response)Response failed.voidresponseFailed(ZestRequest request, ZestResponse response, ZestAssertion assertion)Response failed.voidresponsePassed(ZestRequest request, ZestResponse response)Response passed.voidresponsePassed(ZestRequest request, ZestResponse response, ZestAssertion assertion)Response passed.Stringrun(ZestScript script, Map<String,String> params)Run.Stringrun(ZestScript script, ZestRequest target, Map<String,String> tokens)Run.StringrunScript(Reader reader, Map<String,String> params)Run script.StringrunScript(String script, Map<String,String> params)Run script.ZestResponserunStatement(ZestScript script, ZestStatement stmt, ZestResponse lastRes)Run statement.ZestResponsesend(ZestRequest request)Send.voidsetDebug(boolean debug)Turns debugging on or offvoidsetHttpClient(ZestHttpClient httpclient)voidsetOutputWriter(Writer writer)Sets the output writer.voidsetProxy(String host, int port)Sets the proxy.voidsetScriptEngineFactory(ScriptEngineFactory factory)voidsetStandardVariables(ZestRequest request)Sets the standard variables for a request.voidsetStandardVariables(ZestResponse response)Sets the standard variables for a response.voidsetStopOnAssertFail(boolean stop)Sets the stop on assert fail.voidsetStopOnTestFail(boolean stop)Sets the stop on test fail.voidsetVariable(String name, String value)Sets the variable.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mozilla.zest.core.v1.ZestRuntime
getGlobalVariable, setGlobalVariable
-
-
-
-
Constructor Detail
-
ZestBasicRunner
public ZestBasicRunner()
New Zest basic runner with default settings.- Since:
- 0.14.0
-
ZestBasicRunner
public ZestBasicRunner(Integer timeoutInSeconds, boolean skipSSLCertificateCheck)
New Zest basic runner with custom settings- Since:
- 0.14.0
-
ZestBasicRunner
public ZestBasicRunner(ZestHttpClient httpclient)
- Since:
- 0.14.0
-
ZestBasicRunner
public ZestBasicRunner(ScriptEngineFactory factory, ZestHttpClient httpclient)
- Since:
- 0.14.0
-
ZestBasicRunner
public ZestBasicRunner(ScriptEngineFactory factory)
-
-
Method Detail
-
run
public String run(ZestScript script, Map<String,String> params) throws ZestAssertFailException, ZestActionFailException, IOException, ZestInvalidCommonTestException, ZestAssignFailException, ZestClientFailException
Description copied from interface:ZestRunnerRun.- Specified by:
runin interfaceZestRunner- Parameters:
script- the script- Throws:
ZestAssertFailException- the zest assert fail exceptionZestActionFailException- the zest action fail exceptionIOException- Signals that an I/O exception has occurred.ZestInvalidCommonTestException- the zest invalid common test exceptionZestAssignFailException- the zest assign fail exceptionZestClientFailException
-
run
public String run(ZestScript script, ZestRequest target, Map<String,String> tokens) throws ZestAssertFailException, ZestActionFailException, ZestInvalidCommonTestException, IOException, ZestAssignFailException, ZestClientFailException
Description copied from interface:ZestRunnerRun.- Specified by:
runin interfaceZestRunner- Parameters:
script- the scripttarget- the target- Throws:
ZestAssertFailException- the zest assert fail exceptionZestActionFailException- the zest action fail exceptionZestInvalidCommonTestException- the zest invalid common test exceptionIOException- Signals that an I/O exception has occurred.ZestAssignFailException- the zest assign fail exceptionZestClientFailException
-
runStatement
public ZestResponse runStatement(ZestScript script, ZestStatement stmt, ZestResponse lastRes) throws ZestAssertFailException, ZestActionFailException, ZestInvalidCommonTestException, IOException, ZestAssignFailException, ZestClientFailException
Description copied from interface:ZestRunnerRun statement.- Specified by:
runStatementin interfaceZestRunner- Parameters:
script- the scriptstmt- the stmtlastRes- the last response- Returns:
- the zest response
- Throws:
ZestAssertFailException- the zest assert fail exceptionZestActionFailException- the zest action fail exceptionZestInvalidCommonTestException- the zest invalid common test exceptionIOException- Signals that an I/O exception has occurred.ZestAssignFailException- the zest assign fail exceptionZestClientFailException
-
handleAction
public String handleAction(ZestScript script, ZestAction action, ZestResponse lastResponse) throws ZestActionFailException
Description copied from interface:ZestRunnerHandle action.- Specified by:
handleActionin interfaceZestRunner- Parameters:
script- the scriptaction- the actionlastResponse- the last response- Returns:
- the string
- Throws:
ZestActionFailException- the zest action fail exception
-
handleAssignment
public String handleAssignment(ZestScript script, ZestAssignment assign, ZestResponse lastResponse) throws ZestAssignFailException
Description copied from interface:ZestRunnerHandle an assignment.- Specified by:
handleAssignmentin interfaceZestRunner- Parameters:
script- the scriptassign- the assignmentlastResponse- the last response- Returns:
- the string
- Throws:
ZestAssignFailException- the zest assignment fail exception
-
handleLoop
public ZestResponse handleLoop(ZestScript script, ZestLoop<?> loop, ZestResponse lastResponse) throws ZestAssertFailException, ZestActionFailException, ZestInvalidCommonTestException, IOException, ZestAssignFailException, ZestClientFailException
- Specified by:
handleLoopin interfaceZestRunner- Throws:
ZestAssertFailExceptionZestActionFailExceptionZestInvalidCommonTestExceptionIOExceptionZestAssignFailExceptionZestClientFailException
-
handleControlLoopBreak
public void handleControlLoopBreak()
-
handleControlLoopNext
public void handleControlLoopNext()
-
handleClient
public String handleClient(ZestScript script, ZestClient client) throws ZestClientFailException
- Specified by:
handleClientin interfaceZestRunner- Throws:
ZestClientFailException
-
output
public void output(String str)
Description copied from interface:ZestOutputWriterOutputs the specified string- Specified by:
outputin interfaceZestOutputWriter
-
debug
public void debug(String str)
Description copied from interface:ZestOutputWriterOutputs the supplied message if debugging is turned on- Specified by:
debugin interfaceZestOutputWriter
-
send
public ZestResponse send(ZestRequest request) throws IOException
Description copied from interface:ZestRunnerSend.- Specified by:
sendin interfaceZestRunner- Parameters:
request- the request- Returns:
- the zest response
- Throws:
IOException- Signals that an I/O exception has occurred.
-
handleResponse
public void handleResponse(ZestRequest request, ZestResponse response) throws ZestAssertFailException
Description copied from interface:ZestRunnerHandle response.- Specified by:
handleResponsein interfaceZestRunner- Parameters:
request- the requestresponse- the response- Throws:
ZestAssertFailException- the zest assert fail exception
-
responsePassed
public void responsePassed(ZestRequest request, ZestResponse response, ZestAssertion assertion)
Description copied from interface:ZestRunnerResponse passed.- Specified by:
responsePassedin interfaceZestRunner- Parameters:
request- the requestresponse- the responseassertion- the assertion
-
responseFailed
public void responseFailed(ZestRequest request, ZestResponse response, ZestAssertion assertion) throws ZestAssertFailException
Description copied from interface:ZestRunnerResponse failed.- Specified by:
responseFailedin interfaceZestRunner- Parameters:
request- the requestresponse- the responseassertion- the assertion- Throws:
ZestAssertFailException- the zest assert fail exception
-
responsePassed
public void responsePassed(ZestRequest request, ZestResponse response)
Description copied from interface:ZestRunnerResponse passed.- Specified by:
responsePassedin interfaceZestRunner- Parameters:
request- the requestresponse- the response
-
responseFailed
public void responseFailed(ZestRequest request, ZestResponse response)
Description copied from interface:ZestRunnerResponse failed.- Specified by:
responseFailedin interfaceZestRunner- Parameters:
request- the requestresponse- the response
-
runScript
public String runScript(Reader reader, Map<String,String> params) throws ZestAssertFailException, ZestActionFailException, IOException, ZestInvalidCommonTestException, ZestAssignFailException, ZestClientFailException
Description copied from interface:ZestRunnerRun script.- Specified by:
runScriptin interfaceZestRunner- Parameters:
reader- the reader- Throws:
ZestAssertFailException- the zest assert fail exceptionZestActionFailException- the zest action fail exceptionIOException- Signals that an I/O exception has occurred.ZestInvalidCommonTestException- the zest invalid common test exceptionZestAssignFailException- the zest assign fail exceptionZestClientFailException
-
runScript
public String runScript(String script, Map<String,String> params) throws ZestAssertFailException, ZestActionFailException, IOException, ZestInvalidCommonTestException, ZestAssignFailException, ZestClientFailException
Description copied from interface:ZestRunnerRun script.- Specified by:
runScriptin interfaceZestRunner- Parameters:
script- the script- Throws:
ZestAssertFailException- the zest assert fail exceptionZestActionFailException- the zest action fail exceptionIOException- Signals that an I/O exception has occurred.ZestInvalidCommonTestException- the zest invalid common test exceptionZestAssignFailException- the zest assign fail exceptionZestClientFailException
-
setStopOnAssertFail
public void setStopOnAssertFail(boolean stop)
Description copied from interface:ZestRunnerSets the stop on assert fail.- Specified by:
setStopOnAssertFailin interfaceZestRunner- Parameters:
stop- the new stop on assert fail
-
setStopOnTestFail
public void setStopOnTestFail(boolean stop)
Description copied from interface:ZestRunnerSets the stop on test fail.- Specified by:
setStopOnTestFailin interfaceZestRunner- Parameters:
stop- the new stop on test fail
-
getStopOnAssertFail
public boolean getStopOnAssertFail()
Description copied from interface:ZestRunnerGets the stop on assert fail.- Specified by:
getStopOnAssertFailin interfaceZestRunner- Returns:
- the stop on assert fail
-
getStopOnTestFail
public boolean getStopOnTestFail()
Description copied from interface:ZestRunnerGets the stop on test fail.- Specified by:
getStopOnTestFailin interfaceZestRunner- Returns:
- the stop on test fail
-
setOutputWriter
public void setOutputWriter(Writer writer)
Description copied from interface:ZestRunnerSets the output writer.- Specified by:
setOutputWriterin interfaceZestRunner- Parameters:
writer- the new output writer
-
setProxy
public void setProxy(String host, int port)
Description copied from interface:ZestRuntimeSets the proxy.- Specified by:
setProxyin interfaceZestRuntime- Parameters:
host- the hostport- the port
-
getProxy
public String getProxy()
Description copied from interface:ZestRuntimeGets the proxy, as host:port- Specified by:
getProxyin interfaceZestRuntime
-
getVariable
public String getVariable(String name)
Description copied from interface:ZestRunnerGets the variable.- Specified by:
getVariablein interfaceZestRunner- Specified by:
getVariablein interfaceZestRuntime- Parameters:
name- the name- Returns:
- the variable
-
getVariables
public Map<String,String> getVariables()
Description copied from interface:ZestRunnerGets the variables.- Specified by:
getVariablesin interfaceZestRunner- Returns:
- a map with variables' name to value.
-
setVariable
public void setVariable(String name, String value)
Description copied from interface:ZestRunnerSets the variable.- Specified by:
setVariablein interfaceZestRunner- Specified by:
setVariablein interfaceZestRuntime- Parameters:
name- the namevalue- the value
-
setStandardVariables
public void setStandardVariables(ZestRequest request)
Sets the standard variables for a request.- Specified by:
setStandardVariablesin interfaceZestRuntime- Parameters:
request- the new standard variables
-
setStandardVariables
public void setStandardVariables(ZestResponse response)
Sets the standard variables for a response.- Specified by:
setStandardVariablesin interfaceZestRuntime- Parameters:
response- the new standard variables
-
setHttpClient
public void setHttpClient(ZestHttpClient httpclient)
- Since:
- 0.14.0
-
getLastResponse
public ZestResponse getLastResponse()
Description copied from interface:ZestRuntimeGet the last response.- Specified by:
getLastResponsein interfaceZestRuntime- Returns:
- the last response
-
getLastRequest
public ZestRequest getLastRequest()
Description copied from interface:ZestRuntimeGet the last request.- Specified by:
getLastRequestin interfaceZestRuntime- Returns:
- the last request
-
replaceVariablesInString
public String replaceVariablesInString(String str, boolean urlEncode)
Description copied from interface:ZestRuntimeReplace any variables in the supplied string- Specified by:
replaceVariablesInStringin interfaceZestRuntime- Returns:
- the string with the variables replaces
-
setScriptEngineFactory
public void setScriptEngineFactory(ScriptEngineFactory factory)
- Specified by:
setScriptEngineFactoryin interfaceZestRunner
-
getScriptEngineFactory
public ScriptEngineFactory getScriptEngineFactory()
- Specified by:
getScriptEngineFactoryin interfaceZestRuntime
-
setDebug
public void setDebug(boolean debug)
Description copied from interface:ZestRunnerTurns debugging on or off- Specified by:
setDebugin interfaceZestRunner
-
isDebug
public boolean isDebug()
Description copied from interface:ZestRunnerReports if debugging is enabled- Specified by:
isDebugin interfaceZestRunner- Returns:
trueif debug is enabled,falseotherwise.
-
addWebDriver
public void addWebDriver(String handle, org.openqa.selenium.WebDriver wd)
Description copied from interface:ZestRuntimeAdd a handle associated with a WebDriver- Specified by:
addWebDriverin interfaceZestRuntime
-
removeWebDriver
public void removeWebDriver(String handle)
Description copied from interface:ZestRuntimeRemove a handle associated with a WebDriver- Specified by:
removeWebDriverin interfaceZestRuntime
-
getWebDriver
public org.openqa.selenium.WebDriver getWebDriver(String handle)
Description copied from interface:ZestRuntimeGet the WebDriver assicated with the handle- Specified by:
getWebDriverin interfaceZestRuntime- Returns:
- the
WebDriver.
-
getWebDrivers
public List<org.openqa.selenium.WebDriver> getWebDrivers()
Description copied from interface:ZestRuntimeReturn all of the WebDrivers- Specified by:
getWebDriversin interfaceZestRuntime- Returns:
- all the
WebDrivers.
-
-