com.canoo.webtest.steps.request
Class TargetHelper

java.lang.Object
  extended by com.canoo.webtest.steps.request.TargetHelper
All Implemented Interfaces:
Serializable

public class TargetHelper
extends Object
implements Serializable

This is a helper class for all test specification steps that initiate a request.

It offers common functionality like: preparing the request in case basic authentication is required, handling http error scenarios, reporting and saving away the response if successful.

Author:
Carsten Seibert, Marc Guillemot, Paul King
See Also:
Serialized Form

Field Summary
static String CONNECTION_INITIALIZER_KEY
           
 
Constructor Summary
TargetHelper(AbstractBrowserAction step)
           
 
Method Summary
 com.gargoylesoftware.htmlunit.Page getResponse(Context context, String strUrl)
          Hook for test stubs in order to avoid invocation of a real request
 com.gargoylesoftware.htmlunit.Page getResponse(Context context, com.gargoylesoftware.htmlunit.WebRequest settings)
           
protected  void invokeCustomInitializer(Context context, String customInitializerClassName)
           
protected  void prepareConversationIfNeeded(Context context)
          Prepare the specified WebConversation for a request by setting user and password (if specified) and install a custom HostnameVerifier if required by the currently used protocol.
 void setPassword(String password)
           
 void setUsername(String userName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION_INITIALIZER_KEY

public static final String CONNECTION_INITIALIZER_KEY
See Also:
Constant Field Values
Constructor Detail

TargetHelper

public TargetHelper(AbstractBrowserAction step)
Method Detail

setUsername

public void setUsername(String userName)

setPassword

public void setPassword(String password)

getResponse

public com.gargoylesoftware.htmlunit.Page getResponse(Context context,
                                                      String strUrl)
                                               throws IOException,
                                                      SAXException
Hook for test stubs in order to avoid invocation of a real request

Parameters:
context - The current test context.
strUrl - The URL to invoke.
Throws:
IOException
SAXException

getResponse

public com.gargoylesoftware.htmlunit.Page getResponse(Context context,
                                                      com.gargoylesoftware.htmlunit.WebRequest settings)
                                               throws IOException,
                                                      SAXException
Throws:
IOException
SAXException

prepareConversationIfNeeded

protected void prepareConversationIfNeeded(Context context)
Prepare the specified WebConversation for a request by setting user and password (if specified) and install a custom HostnameVerifier if required by the currently used protocol.

Parameters:
context - The current test context.

invokeCustomInitializer

protected void invokeCustomInitializer(Context context,
                                       String customInitializerClassName)

Copyright © 2001-2007 Canoo Engineering AG, Basel. All rights reserved.