org.mozilla.mcp.junit
Class WebclientTestCase

java.lang.Object
  extended by TestCase
      extended by org.mozilla.mcp.junit.WebclientTestCase

public abstract class WebclientTestCase
extends TestCase

WebclientTestCase extends junit.framework.TestCase and allows using MCP from a JUnit test. It makes assertions that verify preconditions for running MCP.

This class currently has a number of undocumented and unsupported features that can be useful if you take the time to look at the source. Specifically, it has the ability to capture output from running the testcase, compare that output with a golden file, and it has a trivial HTTP server built in so webclient automated tests can run without any extra server baggage.

Version:
$Id: WebclientTestCase.java,v 1.1 2007/05/04 17:10:17 edburns%acm.org Exp $

Field Summary
static java.util.logging.Logger LOGGER
           
static java.lang.String OUTPUT_FILE_ROOT
           
static java.lang.String TEST_LOG
           
static java.lang.String TEST_LOG_STRINGS
           
static java.lang.String WEBCLIENT_LOG_MODULE
           
static java.lang.String WEBCLIENTSTUB_LOG_MODULE
           
 
Constructor Summary
WebclientTestCase()
           
WebclientTestCase(java.lang.String name)
           
 
Method Summary
static TestSuite createServerTestSuite()
           
protected static java.lang.String getBrowserBinDir()
           
 java.lang.String getExpectedOutputFilename()
           
 java.util.List getIgnoreKeywords()
           
 boolean getIgnorePrefix()
           
 boolean getIgnoreWarnings()
           
 java.lang.String[] getLinesToIgnore()
           
static java.util.logging.Logger getLogger(java.lang.String loggerName)
           
protected static java.lang.String getOutputFileRoot()
           
 boolean sendOutputToFile()
           
 void setUp()
           
 void tearDown()
           
protected static void verifyBinDirSet()
           
 boolean verifyExpectedOutput()
           
protected  void verifyLogModuleValueIsAtLeastN(java.lang.String logModuleName, int n)
          assertTrue that the string logModuleName is a correct log module string as specified in pr_log.h, and that its value is at least n.
protected  java.lang.String verifyOutputFileIsSet()
          assertTrue that NSPR_LOG_FILE is set.
protected  void verifyPreconditions()
          This implementation checks that the proper environment vars are set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEBCLIENTSTUB_LOG_MODULE

public static final java.lang.String WEBCLIENTSTUB_LOG_MODULE
See Also:
Constant Field Values

WEBCLIENT_LOG_MODULE

public static final java.lang.String WEBCLIENT_LOG_MODULE
See Also:
Constant Field Values

OUTPUT_FILE_ROOT

public static java.lang.String OUTPUT_FILE_ROOT

TEST_LOG

public static final java.lang.String TEST_LOG
See Also:
Constant Field Values

TEST_LOG_STRINGS

public static final java.lang.String TEST_LOG_STRINGS
See Also:
Constant Field Values

LOGGER

public static final java.util.logging.Logger LOGGER
Constructor Detail

WebclientTestCase

public WebclientTestCase()

WebclientTestCase

public WebclientTestCase(java.lang.String name)
Method Detail

getLogger

public static java.util.logging.Logger getLogger(java.lang.String loggerName)

setUp

public void setUp()

tearDown

public void tearDown()

createServerTestSuite

public static TestSuite createServerTestSuite()

verifyLogModuleValueIsAtLeastN

protected void verifyLogModuleValueIsAtLeastN(java.lang.String logModuleName,
                                              int n)
assertTrue that the string logModuleName is a correct log module string as specified in pr_log.h, and that its value is at least n.


verifyBinDirSet

protected static void verifyBinDirSet()

getBrowserBinDir

protected static java.lang.String getBrowserBinDir()

getOutputFileRoot

protected static java.lang.String getOutputFileRoot()

verifyOutputFileIsSet

protected java.lang.String verifyOutputFileIsSet()
assertTrue that NSPR_LOG_FILE is set.


verifyPreconditions

protected void verifyPreconditions()
This implementation checks that the proper environment vars are set.


verifyExpectedOutput

public boolean verifyExpectedOutput()

getExpectedOutputFilename

public java.lang.String getExpectedOutputFilename()
Returns:
the name of the expected output filename for this testcase.

getLinesToIgnore

public java.lang.String[] getLinesToIgnore()

getIgnoreKeywords

public java.util.List getIgnoreKeywords()

getIgnorePrefix

public boolean getIgnorePrefix()

getIgnoreWarnings

public boolean getIgnoreWarnings()

sendOutputToFile

public boolean sendOutputToFile()


Copyright © 2002-2007 Mozilla.org All Rights Reserved.