net.sf.jameleon
Class TestCaseTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jameleon.LocationAwareTagSupport
          extended by net.sf.jameleon.JameleonTagSupport
              extended by net.sf.jameleon.data.AbstractDataDrivableTag
                  extended by net.sf.jameleon.data.AbstractFileDrivableTag
                      extended by net.sf.jameleon.AbstractCsvTag
                          extended by net.sf.jameleon.TestCaseTag
All Implemented Interfaces:
DataDrivable, BreakPoint, Attributable, DataDrivableResultRecordable, FunctionResultRecordable, SessionResultRecordable, DynaTag, LocationAware, Tag

public class TestCaseTag
extends AbstractCsvTag

Every test case script must have at least one testcase tag containing all other Jameleon tags.

Some of this tags attribute may affect every nested Jameleon tag. Many of the attributes in this tag can be set globally via a jameleon.conf file.

The order of setting variables in the context follows:

  1. Load the CSV file variables and put them in the context.
  2. Load the $testEnvironment-Applications.properties and then Applications.properties and only set the variables that aren't set in the previous files. In other words, if there are variables that are going to be the same ( like the page title ) across multiple test cases, then first variable set wins.
  3. Execute the function tag and set the attributes in the context. If you want key/values in the CSV and properties files to override the script attribute, then the function point author uses the setDefaultVariableValue() method in the set method for that attribute.
  4. If the function point is using a map-variable, then override all settings to set the variable to the mapFrom variable name.

Tag Name: <testcase>
Tag Name: <test-case>

Field Summary
protected static String APPLICATIONS_PROPERTIES
           
protected  String assertGreaterThanLevel
           
protected  String assertLessThanLevel
           
protected  String assertLevel
           
protected  String assertLevels
           
protected  File baseDir
          The baseDir where everything else is based
protected  String bugTrackerUrl
           
protected  String csvValueSeparator
           
protected  DataDrivableRowResult ddRowResult
           
protected static int DEFAULT_ROW
           
protected static String DEFAULT_VALUE_SEPARATOR
           
protected  boolean enableSslCertCheck
          Enable/disable validity checking for SSL certificates.
protected  TestCaseEventHandler eventHandler
           
protected  boolean executeTestCase
           
protected  boolean failedOnDataDriver
          Used to flag if a CSV file is not found.
protected  boolean failOnCSVFileNotFound
          DEFAULT - true.
protected  boolean genTestCaseDocs
           
protected  String genTestCaseDocsEncoding
           
protected  String jameleonConfigName
          The name of the Jameleon configuration file.
protected  ArrayList keysSet
           
protected  long maxExecutionTime
           
protected  String organization
           
protected  String propsName
           
protected  TestCaseResult results
          The test case results which are a complete set of results for every tag executed.
protected  File resultsDir
          The directory name to store the results to.
protected  File resultsFile
           
protected  CountableDataDrivableResultContainer rowResultContainer
           
protected  long startTime
           
protected  boolean storeDisplayOnError
          Only store the displayed screen being tested to a file on an error.
protected  boolean storeEveryDisplay
          Store all displayed screens to a file..
protected  TestCase testCase
           
protected  String testCaseMainPageTemplate
           
protected  String testCaseResultDataRowTemplate
           
protected  String testCaseResultFunctionTemplate
           
protected  String testCaseResultSessionTemplate
           
protected  String testCaseResultSummaryTemplate
           
protected  String testCaseResultTemplate
           
protected  String testCaseSummaryTemplate
           
protected  String testEnvironment
           
protected  File timestampedResultsDir
          The timestamped directory to store the results to.
protected  boolean trace
           
protected  boolean useCSV
           
 
Fields inherited from class net.sf.jameleon.AbstractCsvTag
csv, csvFileName, name
 
Fields inherited from class net.sf.jameleon.data.AbstractFileDrivableTag
charset, dataDir, fileName
 
Fields inherited from class net.sf.jameleon.data.AbstractDataDrivableTag
addt, breakPoint, countRow, dataDrivableRowResult, executer, failedOnCurrentRow, log, numOfRowFailures, parentFailed, previousStateDir, resultContainer, resultRecorder, rowData, stateStorer, stopTestExecutionOnFailure, tct, vars, xmlOut
 
Fields inherited from class net.sf.jameleon.JameleonTagSupport
attributes, broker, contextVars, fp, unsupportedAttributes
 
Fields inherited from class net.sf.jameleon.LocationAwareTagSupport
columnNumber, elementTagName, lineNumber, scriptFileName
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
TestCaseTag()
           
 
Method Summary
protected  void addValuesFromResourceBundle(ResourceBundle props, Properties p, String startOfKey, boolean overrideValue)
           
 void addVariablesToRowData(Map vars)
          Used to add key/values to a local context for multiple variable substitution.
protected  JellyTagException createExceptionFromResult(JameleonTestResult jtr)
           
protected  JellyTagException createExceptionFromResult(String message, JameleonTestResult jtr)
           
 void doTag(XMLOutput out)
          This method executes the tags inside the test-case tag.
protected  void executeBody(Runnable r)
           
 void executeDrivableRow(int rowNum)
          A CsvExecutable implementation method that gets called once for every row in the csv file.
protected  void executeNoCSV()
           
 String getAssertGreaterThanLevel()
           
 String getAssertLessThanLevel()
           
 String getAssertLevel()
           
protected  int getAssertLevelFromString(String assertLevel)
           
 String getAssertLevels()
           
 File getBaseDir()
           
 String getBugTrackerUrl()
          Sets the url of the bugtracking tool used so the bug's listed for the test case are linked.
 File getCsvDir(boolean calculate)
          Gets the directory of where csv files should be read from, given the environment settings.
 DataDrivableRowResult getDdResult()
           
 String getGenTestCaseDocsEncoding()
           
 String getJameleonConfigName()
           
 List getKeySet()
           
protected  org.apache.log4j.Logger getLogger()
          Gets the logger used for this tag
 long getMaxExecutionTime()
          Gets the maximum execution time before the test case fails
 String getOrganization()
           
 Properties getPropertiesForApplication(String applicationName)
          This method creates a new Properties Object populated only with the properties for application desired.
 String getPropsName()
          Gets the name of the properties file (minus the .properties) to read in into the context
 TestCaseResult getResults()
           
 File getResultsDir()
          Gets the directory where the results will be written to.
 File getResultsDir(boolean includeName)
          Gets the directory where the results will be written to.
protected  File getResultsDir(int rowCount)
           
 File getResultsFile()
          Gets the results file that represents the test case execution.
 StateStorer getStateStorer()
           
 String getTagDescription()
          Describe the tag when error messages occur.
protected  String getTagTraceMsg()
          Gets the trace message when the execution is beginning and ending.
 TestCase getTestCase()
           
 String getTestCaseMainPageTemplate()
          Gets the template to be used to generate the main page of the results..
 String getTestCaseResultDataRowTemplate()
          Gets the data row template to be used to generate the data drivable result.
 String getTestCaseResultFunctionTemplate()
          Gets the template to be used to generate the function result.
 String getTestCaseResultSessionTemplate()
          Gets the session template to be used to generate the session result.
 String getTestCaseResultSummaryTemplate()
          Gets the template to be used to generate the test case result summary page.
 String getTestCaseResultTemplate()
          Gets the template to be used to generate the test case result page.
 String getTestCaseSummaryTemplate()
          Gets the template to be used to generate the test case summary page of the results..
protected  TestCaseTag getTestCaseTag()
          Gets the TestCaseTag for this tag.
 String getTestEnvironment()
           
 File getTimestampedResultsDir()
          Gets the timestamped results directory where the test case result documentation will be stored.
 boolean getTrace()
          Gets whether a std out message should be sent before and after the execution of a functional point.
protected  void initResults()
           
 void invokeChildren(int rowNum, JameleonTestResult result)
          Execute the rest of the test script.
 boolean isEnableSslCertCheck()
          Query whether SSL cert validity checking is enabled.
 boolean isExecuteTestCase()
           
 boolean isGenTestCaseDocs()
           
protected  boolean isValidateAssertLevel(String level)
           
protected  ResourceBundle loadApplicationProperties()
          Loads the properties for all applications.
protected  void loadJameleonConfig()
          Loads the properties for all applications.
protected  void logError(Throwable t)
          Logs an error in XML format for easy interpreting later.
protected  String[] parseAssertLevels()
           
protected  void recordResult(JameleonTestResult result)
          Records a child result.
 void setAssertGreaterThanLevel(String assertGreaterThanLevel)
           
 void setAssertLessThanLevel(String assertLessThanLevel)
           
 void setAssertLevel(String assertLevel)
           
protected  void setAssertLevels()
           
 void setAssertLevels(String assertLevels)
          Sets the level of the asserts to run that are equal to this list of numbers.
 void setBaseDir(File baseDir)
          Sets the base directory of the project
 void setBugTrackerUrl(String bugTrackerUrl)
          Sets the url of the bugtracking tool used so the bug's listed for the test case are linked.
 void setEnableSslCertCheck(boolean enable)
          Enable or disable validity checking of SSL certificates.
 void setExecuteTestCase(boolean executeTestCase)
          Sets the test case to be executed or not.
 void setFailedOnDataDriver(boolean failedOnDataDriver)
          Used internally to mark whether the DataDrivable had a problem.
 void setFailOnCSVFileNotFound(boolean failOnCSVFileNotFound)
          Sets the failOnCSVFileNotFound property
protected  void setFileFromEnvironment(Configurator config, String key)
           
 void setGenTestCaseDocs(boolean genTestCaseDocs)
          Sets the test case to generate the test case docs based on the javadocs of the functional points and the functionId's of the functional points in the test case.
 void setGenTestCaseDocsEncoding(String encoding)
          Sets the charset encoding.
 void setJameleonConfigName(String configName)
          Sets the configuration file Jameleon uses to configure itself.
protected  void setLocationAware(LocationAware la)
           
 void setMaxExecutionTime(long maxExecutionTime)
          Sets the maximum execution time before the test case fails
 void setOrganization(String organization)
          Sets the organziation or company that this test will be run against.
 void setPropsName(String propsName)
          Sets the name of the properties file (minus the .properties) to read in into the context
 void setResults(TestCaseResult results)
           
 void setResultsDir(File resultsDir)
          Sets the directory where the results will be written to.
protected  void setStateStoreOptions()
           
 void setStoreStateEvent(String event)
          Sets the test case to record the state of the application at a defined event
 void setStoreStateNever(boolean none)
          Sets the test case to never record the state of the application.
 void setStoreStateOnChange(boolean all)
          Sets the test case to record the state of the application whenever the application's state changes.
 void setStoreStateOnError(boolean onError)
          Sets the test case to record the state of the application on errors.
 void setTestCaseMainPageTemplate(String testCaseMainPageTemplate)
          Sets the template to be used to generate the main page of the results..
 void setTestCaseResultDataRowTemplate(String testCaseResultDataRowTemplate)
          Sets the data row template to be used to generate the data drivable result.
 void setTestCaseResultFunctionTemplate(String testCaseResultFunctionTemplate)
          Sets the function result template to be used to generate the test case result.
 void setTestCaseResultSessionTemplate(String testCaseResultSessionTemplate)
          Sets the session template to be used to generate the session result.
 void setTestCaseResultSummaryTemplate(String testCaseResultSummaryTemplate)
          Sets the template to be used to generate the test case result summary page.
 void setTestCaseResultTemplate(String testCaseResultTemplate)
          Sets the template to be used to generate the test case result summary page.
 void setTestCaseSummaryTemplate(String testCaseSummaryTemplate)
          Sets the template to be used to generate the test case summary page of the results.
 void setTestEnvironment(String testEnvironment)
          Sets the environment to which testing system the testcase will be run in.
 void setTimestampedResultsDir(File timestampedResultsDir)
          Sets the timestamped results directory where the test case result documentation will be stored.
 void setTrace(boolean trace)
          Sets whether a std out message should be sent before and after the execution of a functional point.
 void setUp()
          Set up the test environment.
 void setUseCSV(boolean useCSV)
          Sets whether a CSV file should be used for this testcase or not.
protected  void setValueFromEnvironment(Configurator config, String key)
           
protected  void spanCSV()
          useCSV is set to true, data-drive this CSV file.
 void substituteKeyValues()
          Do variable subsitution on values stored from data file.
protected  void substituteValues(Properties p)
          Do variable substition based on keys in the iterator.
 void tearDown()
          Clean things up after the test case has been executed.
protected  void validateAttributes()
          Validate the parameters
 
Methods inherited from class net.sf.jameleon.AbstractCsvTag
getCsvCharset, getCsvDir, getCsvFile, getCsvFileName, getCsvValueSeparator, getDataDriver, getDataExceptionMessage, getName, getNewStateStoreLocation, setCsvCharset, setCsvDir, setCsvFileName, setCsvValueSeparator, setName, setupDataDriver
 
Methods inherited from class net.sf.jameleon.data.AbstractFileDrivableTag
getDataDir, getDataDir, setCharset, setDataDir, setFile
 
Methods inherited from class net.sf.jameleon.data.AbstractDataDrivableTag
createNewResult, destroyVariables, getDataDrivableRowResult, getFailedOnCurrentRow, getKeyMapping, getResultContainer, getRowData, getTraceKeyValuePairs, init, isBreakPoint, isCountRow, mapKeys, recordDataDrivableResult, recordFunctionResult, recordSessionResult, recordThisResult, removeChildlessResult, setBreakPoint, setCountRow, setFailedOnCurrentRow, setResultError, setStopTestExecutionOnFailure, setUpDataDrivable, setVariablesInContext, traceMsg
 
Methods inherited from class net.sf.jameleon.JameleonTagSupport
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught
 
Methods inherited from class net.sf.jameleon.LocationAwareTagSupport
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Field Detail

maxExecutionTime

protected long maxExecutionTime

assertGreaterThanLevel

protected String assertGreaterThanLevel

assertLessThanLevel

protected String assertLessThanLevel

assertLevel

protected String assertLevel

assertLevels

protected String assertLevels

testEnvironment

protected String testEnvironment

organization

protected String organization

csvValueSeparator

protected String csvValueSeparator

bugTrackerUrl

protected String bugTrackerUrl

genTestCaseDocsEncoding

protected String genTestCaseDocsEncoding

propsName

protected String propsName

useCSV

protected boolean useCSV

trace

protected boolean trace

genTestCaseDocs

protected boolean genTestCaseDocs

executeTestCase

protected boolean executeTestCase

testCaseResultDataRowTemplate

protected String testCaseResultDataRowTemplate

testCaseResultSessionTemplate

protected String testCaseResultSessionTemplate

testCaseResultFunctionTemplate

protected String testCaseResultFunctionTemplate

testCaseMainPageTemplate

protected String testCaseMainPageTemplate

testCaseSummaryTemplate

protected String testCaseSummaryTemplate

testCaseResultSummaryTemplate

protected String testCaseResultSummaryTemplate

testCaseResultTemplate

protected String testCaseResultTemplate

eventHandler

protected TestCaseEventHandler eventHandler

startTime

protected long startTime

resultsFile

protected File resultsFile

rowResultContainer

protected CountableDataDrivableResultContainer rowResultContainer

failOnCSVFileNotFound

protected boolean failOnCSVFileNotFound
DEFAULT - true. If set to false, then don't error and don't even log the test case. If a file is found, then go ahead and log test case results


failedOnDataDriver

protected boolean failedOnDataDriver
Used to flag if a CSV file is not found. This is used only when failOnCSVFileNotFound is set to false


results

protected TestCaseResult results
The test case results which are a complete set of results for every tag executed.


ddRowResult

protected DataDrivableRowResult ddRowResult

keysSet

protected ArrayList keysSet

testCase

protected TestCase testCase

storeDisplayOnError

protected boolean storeDisplayOnError
Only store the displayed screen being tested to a file on an error.


storeEveryDisplay

protected boolean storeEveryDisplay
Store all displayed screens to a file..


baseDir

protected File baseDir
The baseDir where everything else is based


resultsDir

protected File resultsDir
The directory name to store the results to. Defaults to ./jameleon_test_results


timestampedResultsDir

protected File timestampedResultsDir
The timestamped directory to store the results to.


jameleonConfigName

protected String jameleonConfigName
The name of the Jameleon configuration file. (default is defined in Configurator)


enableSslCertCheck

protected boolean enableSslCertCheck
Enable/disable validity checking for SSL certificates. Default is true (enabled). Set to false to prevent exceptions from being thrown for invalid SSL certs.


APPLICATIONS_PROPERTIES

protected static final String APPLICATIONS_PROPERTIES
See Also:
Constant Field Values

DEFAULT_ROW

protected static final int DEFAULT_ROW
See Also:
Constant Field Values

DEFAULT_VALUE_SEPARATOR

protected static final String DEFAULT_VALUE_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

TestCaseTag

public TestCaseTag()
Method Detail

getDdResult

public DataDrivableRowResult getDdResult()

getLogger

protected org.apache.log4j.Logger getLogger()
Gets the logger used for this tag

Specified by:
getLogger in class AbstractDataDrivableTag
Returns:
the logger used for this tag.

getTagTraceMsg

protected String getTagTraceMsg()
Gets the trace message when the execution is beginning and ending. The message displayed will already start with BEGIN: or END:

Specified by:
getTagTraceMsg in class AbstractDataDrivableTag
Returns:
the trace message when the execution is just beginning and ending.

getTagDescription

public String getTagDescription()
Describe the tag when error messages occur. The most appropriate message might be the tag name itself.

Specified by:
getTagDescription in class AbstractDataDrivableTag
Returns:
A brief description of the tag or the tag name itself.

getTestCaseTag

protected TestCaseTag getTestCaseTag()
Description copied from class: AbstractDataDrivableTag
Gets the TestCaseTag for this tag. The default implementation searches for it as an ancestor and throws a ClassCastException if it can't find it.

Overrides:
getTestCaseTag in class AbstractDataDrivableTag
Returns:
the TestCaseTag this tag is nested in.

addVariablesToRowData

public void addVariablesToRowData(Map vars)
Used to add key/values to a local context for multiple variable substitution. Since a test case can have multiple sessions and sessions are application specific, then variables with ${varName} in them can be different values depending on the application settings in the Applications.properties.

Specified by:
addVariablesToRowData in interface DataDrivable
Overrides:
addVariablesToRowData in class AbstractDataDrivableTag
Parameters:
vars - - A map of key-value pairs.

getTestCaseResultSessionTemplate

public String getTestCaseResultSessionTemplate()
Gets the session template to be used to generate the session result. This is searched for in the classpath.

Returns:
the session template to be used to generate the test case docs.

setTestCaseResultSessionTemplate

public void setTestCaseResultSessionTemplate(String testCaseResultSessionTemplate)
Sets the session template to be used to generate the session result. This is searched for in the classpath.

Parameters:
testCaseResultSessionTemplate - the session template to be used to generate the test case docs.This attribute is recognized by Jameleon

getTestCaseResultDataRowTemplate

public String getTestCaseResultDataRowTemplate()
Gets the data row template to be used to generate the data drivable result. This is searched for in the classpath.

Returns:
the data-drivable template to be used to generate the test case docs.

setTestCaseResultDataRowTemplate

public void setTestCaseResultDataRowTemplate(String testCaseResultDataRowTemplate)
Sets the data row template to be used to generate the data drivable result. This is searched for in the classpath.

Parameters:
testCaseResultDataRowTemplate - the data-drivable template to be used to generate the test case docs.This attribute is recognized by Jameleon

getTestCaseResultFunctionTemplate

public String getTestCaseResultFunctionTemplate()
Gets the template to be used to generate the function result. This is searched for in the classpath.

Returns:
the entry leaf template to be used to generate the test case docs.

setTestCaseResultFunctionTemplate

public void setTestCaseResultFunctionTemplate(String testCaseResultFunctionTemplate)
Sets the function result template to be used to generate the test case result. This is searched for in the classpath.

Parameters:
testCaseResultFunctionTemplate - The entry leaf template to be used to generate the test case docs.This attribute is recognized by Jameleon

getTestCaseMainPageTemplate

public String getTestCaseMainPageTemplate()
Gets the template to be used to generate the main page of the results.. This is searched for in the classpath.

Returns:
the template to be used to generate the test case main page.

setTestCaseMainPageTemplate

public void setTestCaseMainPageTemplate(String testCaseMainPageTemplate)
Sets the template to be used to generate the main page of the results.. This is searched for in the classpath.

Parameters:
testCaseMainPageTemplate - The template.This attribute is recognized by Jameleon

getTestCaseSummaryTemplate

public String getTestCaseSummaryTemplate()
Gets the template to be used to generate the test case summary page of the results.. This is searched for in the classpath.

Returns:
the template to be used to generate the test case summary docs.

setTestCaseSummaryTemplate

public void setTestCaseSummaryTemplate(String testCaseSummaryTemplate)
Sets the template to be used to generate the test case summary page of the results. This is searched for in the classpath.

Parameters:
testCaseSummaryTemplate - The template to be used to generate the test case summary docs.This attribute is recognized by Jameleon

getTestCaseResultSummaryTemplate

public String getTestCaseResultSummaryTemplate()
Gets the template to be used to generate the test case result summary page. This is searched for in the classpath.

Returns:
The template to be used to generate the test case result summary page.

setTestCaseResultTemplate

public void setTestCaseResultTemplate(String testCaseResultTemplate)
Sets the template to be used to generate the test case result summary page. This is searched for in the classpath.

Parameters:
testCaseResultTemplate - The template to be used to generate the test case result page.This attribute is recognized by Jameleon

getTestCaseResultTemplate

public String getTestCaseResultTemplate()
Gets the template to be used to generate the test case result page. This is searched for in the classpath.

Returns:
The template to be used to generate the test case result page.

setTestCaseResultSummaryTemplate

public void setTestCaseResultSummaryTemplate(String testCaseResultSummaryTemplate)
Sets the template to be used to generate the test case result summary page. This is searched for in the classpath.

Parameters:
testCaseResultSummaryTemplate - The template to be used to generate the test case result summary page.This attribute is recognized by Jameleon

setResultsDir

public void setResultsDir(File resultsDir)
Sets the directory where the results will be written to.

Parameters:
resultsDir - - the directory where the results will be written to.This attribute is recognized by Jameleon

setTimestampedResultsDir

public void setTimestampedResultsDir(File timestampedResultsDir)
Sets the timestamped results directory where the test case result documentation will be stored.

Parameters:
timestampedResultsDir - The timestamped results directory where the test case result documentation will be stored.

getTimestampedResultsDir

public File getTimestampedResultsDir()
Gets the timestamped results directory where the test case result documentation will be stored.

Returns:
the timestamped results directory where the test case result documentation will be stored.

setStoreStateEvent

public void setStoreStateEvent(String event)
Sets the test case to record the state of the application at a defined event

Parameters:
event - - An event at which the state of the application will be stored. Valid values are:
  • storeStateNever - never store the state of the application.
  • storeStateOnChange - store the state of the applcation on any state change.
  • storeStateOnError - store the state of the application only on an error. DEFAULT
If the event is not valid, then it is not set.This attribute is recognized by Jameleon

setStoreStateOnChange

public void setStoreStateOnChange(boolean all)
Sets the test case to record the state of the application whenever the application's state changes.

Parameters:
all - - Set to true to record all responses. Defaults to falseThis attribute is recognized by Jameleon

setStoreStateOnError

public void setStoreStateOnError(boolean onError)
Sets the test case to record the state of the application on errors.

Parameters:
onError - - Set to true to record responses ONLY on errors. Defaults to trueThis attribute is recognized by Jameleon

setStoreStateNever

public void setStoreStateNever(boolean none)
Sets the test case to never record the state of the application.

Parameters:
none - - Set to true to never record responses. Defaults to falseThis attribute is recognized by Jameleon

getResultsDir

public File getResultsDir()
Gets the directory where the results will be written to.

Returns:
the directory where the results will be written to.

getResultsDir

public File getResultsDir(boolean includeName)
Gets the directory where the results will be written to.

Parameters:
includeName - set to true to include the test case name in the results directory.
Returns:
the directory where the results will be written to.

getResultsDir

protected File getResultsDir(int rowCount)
Parameters:
rowCount - The row number the test case is on
Returns:
the directory where the results will be stored.

getMaxExecutionTime

public long getMaxExecutionTime()
Gets the maximum execution time before the test case fails

Returns:
the maximum execution time before the test case fails

setMaxExecutionTime

public void setMaxExecutionTime(long maxExecutionTime)
Sets the maximum execution time before the test case fails

Parameters:
maxExecutionTime - - the maximum execution time before the test case failsThis attribute is recognized by Jameleon

getStateStorer

public StateStorer getStateStorer()
Returns:
the StateStorer instance created by this TestCaseTag.

setFailedOnDataDriver

public void setFailedOnDataDriver(boolean failedOnDataDriver)
Used internally to mark whether the DataDrivable had a problem. This is used for the failOnCSVFileNotFound option only

Parameters:
failedOnDataDriver - - Set to true if a problem due to DataDrivable occured.This attribute is recognized by Jameleon

setFailOnCSVFileNotFound

public void setFailOnCSVFileNotFound(boolean failOnCSVFileNotFound)
Sets the failOnCSVFileNotFound property

Parameters:
failOnCSVFileNotFound - - Set to false to not log a failure due to a CSV FileNotFoundExceptionThis attribute is recognized by Jameleon

getKeySet

public List getKeySet()
Returns:
the list of keys that have been put into the context.

getOrganization

public String getOrganization()
Returns:
the organization or affiliate this application will be tested against. This would used for when there is one application for many different datasources like our banking applications that one day will run for multiple banks. This is also important because the URLs change between organizations as well.

setOrganization

public void setOrganization(String organization)
Sets the organziation or company that this test will be run against. This is used the same as the testEnvironment to find the CSV file or use values from a properties file specific to an organization.

Parameters:
organization - - The organziation or company that this test will be run against.This attribute is recognized by Jameleon

getTestEnvironment

public String getTestEnvironment()
Returns:
the environment the test cases will be run under

setTestEnvironment

public void setTestEnvironment(String testEnvironment)
Sets the environment to which testing system the testcase will be run in. Information like the starting url, can be based on this. This is also used to find the CSV file if one is used for the test case. This can be set as a global variable.

Parameters:
testEnvironment - Some examples might include, localhost, dev, test, stage, production ...:This attribute is recognized by Jameleon

getResults

public TestCaseResult getResults()
Returns:
the test cases that were run under this environment

setResults

public void setResults(TestCaseResult results)

setUseCSV

public void setUseCSV(boolean useCSV)
Sets whether a CSV file should be used for this testcase or not.

Parameters:
useCSV - - If set to true, then this test case will grab all of it's data from a CSV fileThis attribute is recognized by Jameleon

setTrace

public void setTrace(boolean trace)
Sets whether a std out message should be sent before and after the execution of a functional point.

Parameters:
trace - - If set to true, then this test case will show messages before and after execution of each functional point.This attribute is recognized by Jameleon

getTrace

public boolean getTrace()
Gets whether a std out message should be sent before and after the execution of a functional point.

Returns:
true, if this test case will show messages before and after execution of each functional point.

setBaseDir

public void setBaseDir(File baseDir)
Sets the base directory of the project

Parameters:
baseDir - - The base directory of the projectThis attribute is recognized by Jameleon

getBaseDir

public File getBaseDir()
Returns:
The base directory of the project

getCsvDir

public File getCsvDir(boolean calculate)
Gets the directory of where csv files should be read from, given the environment settings.

Parameters:
calculate - - set to true to calculate in testEnvironment and organization if they apply
Returns:
The csv file to run the test against

getAssertGreaterThanLevel

public String getAssertGreaterThanLevel()
Returns:
the level of the asserts to run that are greater than this number.

setAssertGreaterThanLevel

public void setAssertGreaterThanLevel(String assertGreaterThanLevel)
Parameters:
assertGreaterThanLevel - the level of the asserts to run that are greater than this number.This attribute is recognized by Jameleon

getAssertLessThanLevel

public String getAssertLessThanLevel()
Returns:
the level of the asserts to run that are less than this number.

setAssertLessThanLevel

public void setAssertLessThanLevel(String assertLessThanLevel)
Parameters:
assertLessThanLevel - the level of the asserts to run that are less than this number.This attribute is recognized by Jameleon

getAssertLevel

public String getAssertLevel()
Returns:
the level of the asserts to run that are equal to this number.

setAssertLevel

public void setAssertLevel(String assertLevel)
Parameters:
assertLevel - the level of the asserts to run that are equal to this number.This attribute is recognized by Jameleon

getAssertLevels

public String getAssertLevels()
Returns:
the level of the asserts to run that are equal to this list of numbers.

setAssertLevels

public void setAssertLevels(String assertLevels)
Sets the level of the asserts to run that are equal to this list of numbers.

Parameters:
assertLevels - A list of assert levels to run in the this test caseThis attribute is recognized by Jameleon

setGenTestCaseDocs

public void setGenTestCaseDocs(boolean genTestCaseDocs)
Sets the test case to generate the test case docs based on the javadocs of the functional points and the functionId's of the functional points in the test case.

Parameters:
genTestCaseDocs - - set to true if the test case docs are to be generatedThis attribute is recognized by Jameleon

getTestCase

public TestCase getTestCase()
Returns:
The test case for documentation purposes.

isExecuteTestCase

public boolean isExecuteTestCase()
Returns:
true if the test is actually supposed to be executed. The default is true

isGenTestCaseDocs

public boolean isGenTestCaseDocs()
Returns:
true if the test case results docs are to be generated. The default is true

setExecuteTestCase

public void setExecuteTestCase(boolean executeTestCase)
Sets the test case to be executed or not.

Parameters:
executeTestCase - - Set to false if the functionality of the test case is not to be executed. The default is true. This would be set to false if only the test case docs are to be generated.This attribute is recognized by Jameleon

getBugTrackerUrl

public String getBugTrackerUrl()
Sets the url of the bugtracking tool used so the bug's listed for the test case are linked.

Returns:
the bug tracker url

setBugTrackerUrl

public void setBugTrackerUrl(String bugTrackerUrl)
Sets the url of the bugtracking tool used so the bug's listed for the test case are linked.

Parameters:
bugTrackerUrl - The url of the bugtracking tool used so the bug's listed for the test case are linked.This attribute is recognized by Jameleon

getGenTestCaseDocsEncoding

public String getGenTestCaseDocsEncoding()
Returns:
the character set encoding to use for the test case in XML.

setGenTestCaseDocsEncoding

public void setGenTestCaseDocsEncoding(String encoding)
Sets the charset encoding.

Parameters:
encoding - - the character set encoding to use for the test case in XML.This attribute is recognized by Jameleon

getPropsName

public String getPropsName()
Gets the name of the properties file (minus the .properties) to read in into the context

Returns:
the name of the properties file (minus the .properties) to read in into the context

setPropsName

public void setPropsName(String propsName)
Sets the name of the properties file (minus the .properties) to read in into the context

Parameters:
propsName - - name of the properties file (minus the .properties) to read in into the contextThis attribute is recognized by Jameleon

setJameleonConfigName

public void setJameleonConfigName(String configName)
Sets the configuration file Jameleon uses to configure itself. (default is defined in Configurator) Do not use. This is used for internal testing purposes only.

Parameters:
configName - - the configuration file Jameleon uses to configure itself.This attribute is recognized by Jameleon

getJameleonConfigName

public String getJameleonConfigName()

isEnableSslCertCheck

public boolean isEnableSslCertCheck()
Query whether SSL cert validity checking is enabled.

Returns:
- If true, an exception will be thrown when an invalid SSL cert is encountered. If false, invalid SSL certs will be accepted.

setEnableSslCertCheck

public void setEnableSslCertCheck(boolean enable)
Enable or disable validity checking of SSL certificates.

Parameters:
enable - - If "true", an exception will be thrown when an invalid SSL cert is encountered. If "false", invalid SSL certs will be accepted. If not set, the default is "true".This attribute is recognized by Jameleon

setLocationAware

protected void setLocationAware(LocationAware la)

invokeChildren

public void invokeChildren(int rowNum,
                           JameleonTestResult result)
Execute the rest of the test script.

Parameters:
rowNum - - if a csv file is used, then this pertains to the row number the test case is being executed against. If a CSV file is not used, then 0 is sent.
result - - the results to run with.

executeDrivableRow

public void executeDrivableRow(int rowNum)
A CsvExecutable implementation method that gets called once for every row in the csv file. This does not include the top row which should only define the variable names

Specified by:
executeDrivableRow in interface DataDrivable
Overrides:
executeDrivableRow in class AbstractDataDrivableTag
Parameters:
rowNum - - The row number being executed

initResults

protected void initResults()

setUp

public void setUp()
           throws JellyTagException
Set up the test environment.

Throws:
JellyTagException - if the tag is not in the correct state.

recordResult

protected void recordResult(JameleonTestResult result)
Records a child result. Used as a helper method for the ResultRecordable implementation methods. This method overrides the default behavior of AbstractDataDrivableTag.

Overrides:
recordResult in class AbstractDataDrivableTag
Parameters:
result - - the result to record

doTag

public void doTag(XMLOutput out)
           throws MissingAttributeException,
                  JellyTagException
This method executes the tags inside the test-case tag. If useCSV=true, then the data for the functional points will be grabbed from a CSV file. Otherwise the attributes are all expected to be set the contained functional points. If the functional points' attributes are set and useCSV is set to true, then the data in the CSV file will override the data set in the function points' attributes.

Specified by:
doTag in interface Tag
Overrides:
doTag in class AbstractDataDrivableTag
Throws:
MissingAttributeException
JellyTagException

createExceptionFromResult

protected JellyTagException createExceptionFromResult(JameleonTestResult jtr)

createExceptionFromResult

protected JellyTagException createExceptionFromResult(String message,
                                                      JameleonTestResult jtr)

executeNoCSV

protected void executeNoCSV()

spanCSV

protected void spanCSV()
useCSV is set to true, data-drive this CSV file.


tearDown

public void tearDown()
Clean things up after the test case has been executed.


setStateStoreOptions

protected void setStateStoreOptions()

executeBody

protected void executeBody(Runnable r)

getResultsFile

public File getResultsFile()
Gets the results file that represents the test case execution.

Returns:
the results file that represents the test case execution.

getPropertiesForApplication

public Properties getPropertiesForApplication(String applicationName)
This method creates a new Properties Object populated only with the properties for application desired. The keys for these properties are no longer start with the application name. For example, if a property named "personalBanking.host" exists in the original Properties Object and this method is called with "personalBanking" as the applicationName then the new property name will be "host".

Parameters:
applicationName - The name of the application that you want properties for.
Returns:
a Properties Object populated only with the properties for application desired

substituteValues

protected void substituteValues(Properties p)
Do variable substition based on keys in the iterator.

Parameters:
p - - the properties to be substituted.

substituteKeyValues

public void substituteKeyValues()
Do variable subsitution on values stored from data file.


addValuesFromResourceBundle

protected void addValuesFromResourceBundle(ResourceBundle props,
                                           Properties p,
                                           String startOfKey,
                                           boolean overrideValue)

validateAttributes

protected void validateAttributes()
                           throws MissingAttributeException
Validate the parameters

Throws:
MissingAttributeException - If a parameter is invalid.

parseAssertLevels

protected String[] parseAssertLevels()

isValidateAssertLevel

protected boolean isValidateAssertLevel(String level)
Parameters:
level - - the assert level to check
Returns:
true if the assertLevel is a valid assert level. Must begin with "LEVEL" followed by a digit 1-9.

setAssertLevels

protected void setAssertLevels()

getAssertLevelFromString

protected int getAssertLevelFromString(String assertLevel)

loadApplicationProperties

protected ResourceBundle loadApplicationProperties()
                                            throws IOException
Loads the properties for all applications.

Returns:
The ResourceBundle representing the given application.
Throws:
IOException - When the given file can not be found in the classpath

setValueFromEnvironment

protected void setValueFromEnvironment(Configurator config,
                                       String key)

setFileFromEnvironment

protected void setFileFromEnvironment(Configurator config,
                                      String key)

loadJameleonConfig

protected void loadJameleonConfig()
Loads the properties for all applications.


logError

protected void logError(Throwable t)
Logs an error in XML format for easy interpreting later. The error message prints out all known environment variables and information.

Parameters:
t - The Error to log and set in the result


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.