net.sf.jameleon.plugin.junit
Class ExecuteJameleonScriptTag

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.function.FunctionTag
                  extended by net.sf.jameleon.plugin.junit.JUnitFunctionTag
                      extended by net.sf.jameleon.plugin.junit.ExecuteJameleonScriptTag
All Implemented Interfaces:
BreakPoint, Attributable, Storable, DynaTag, LocationAware, Tag

public class ExecuteJameleonScriptTag
extends JUnitFunctionTag

Used to acceptance test Jameleon tags. Executes a Jameleon script and checks various outputs.

Tag Name: <execute-jameleon-script> Type: action
Steps:
  1. Execute the given script
  2. Validate that the script ran correctly

Nested Class Summary
protected  class ExecuteJameleonScriptTag.FailedRow
           
 
Field Summary
protected  boolean checkOutcomeFailed
          Pass only if the script failed
protected  boolean checkOutcomePassed
          Pass only if the script passed
protected static boolean DEBUG
           
protected  org.apache.log4j.varia.DenyAllFilter denyAll
           
protected  String errorMsgContains
          A snippet of the error message or reason for that is expected in stdout.
protected  int executionTimeGreaterThan
          The execution time should be greater than this number if set
protected  int executionTimeLessThan
          The execution time should be greater than this number if set
protected  StringWriter htmlResults
           
protected  ExecuteTestCase jmln
           
protected  String lineFailedFunctionId
          The functionId of the row that failed
protected  String lineFailedReason
          The given error message for failure in the HTML results
protected  int lineNumFailed
          The line # of the script that is stated as failing in the HTML .
protected  TestCaseListener listener
           
protected  String noFailOnFunctionId
          A functionId where no failure should occur
protected  boolean noTestCaseResults
          TODO
protected  int numOfFailures
          The number of failures that should fail from the script being executed
protected  int numOfFunctionsRun
          The number of functional points that should be run from the script being executed
protected  int numOfTestCasesFailed
          The number of test cases that should fail from the script being executed (for when useCSV is set to true in the testcase tag)
protected  int numOfTestCasesRun
          The number of test cases that should run from the script being executed (for when useCSV is set to true in the testcase tag)
protected  TestCaseCounter originalCounter
           
protected static org.dom4j.io.SAXReader parser
           
protected  TestCaseResult result
           
protected  File script
          The script to execute
protected  Writer stdOutWriter
           
protected  String testCaseDocsFile
          The name of the generated test case doc file.
protected  String testCaseName
          A snippet of the error message or reason for that is expected in stdout.
protected  Writer timestampedResults
           
 
Fields inherited from class net.sf.jameleon.function.FunctionTag
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, vpt
 
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
ExecuteJameleonScriptTag()
           
 
Method Summary
protected  void assertExecutionTimeGreaterThan(long greaterThanTime)
           
protected  void assertExecutionTimeLessThan(long lessThanTime)
           
protected  void assertFunctionIdNotFailed(String noFailOnFunctionId)
           
protected  void assertHtmlTestCaseName(String expected)
           
protected  void assertNumOfFailures(int expected)
           
protected  void assertNumOfFunctionsRun(int expected)
           
protected  void assertNumOfTestCasesFailed(int expected)
           
protected  void assertNumOfTestCasesRun(int expected)
           
protected  void assertOutcomeEquals(String expected)
           
protected  void assertOutcomeFailed()
           
protected  void assertOutcomePassed()
           
protected  void assertTestCaseDocFileEndsWith(String expected)
           
protected  String executeScript()
           
protected  org.dom4j.Document getDocument(StringWriter results)
           
protected  long getExecutionTime()
           
protected  List getFunctionsRun()
           
protected  String getHtmlDisplayedOutcome()
           
protected  String getHtmlDisplayedTestCaseName()
           
protected  org.dom4j.Document getHtmlDocument()
           
protected  String getOutcome()
           
protected  String getRowFromHtml()
           
protected  String getTestCaseDocFile()
           
protected  int getTestCasesFailed()
           
protected  int getTestCasesRun()
           
protected  String getValueFromElement(String elementName, String message)
           
 void setup()
          Does setup for plugin-required intialization.
protected  void setupEnvironment()
          This method is called before anything else is called.
protected  void setUpFunctionResults()
           
protected  String stripHtmlRow()
           
 void tearDown()
          Called when the function is done being executed.
 void testBlock()
          Contains the actual testing of the function point.
 
Methods inherited from class net.sf.jameleon.function.FunctionTag
addParam, addRequiredAttribute, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertFalse, assertFalse, assertMethod, assertMethodWithLevel, assertNotNull, assertNotNull, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNotSame, assertNotSame, assertNull, assertNull, assertNull, assertNull, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertRegexMatches, assertSame, assertSame, assertSame, assertSame, assertTextContains, assertTextContains, assertTextContains, assertTextContains, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextEndsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTextStartsWith, assertTrue, assertTrue, assertTrue, assertTrue, checkParamTypes, cleanUp, cleanUpEnvironment, delay, delay, doTag, fail, fail, fail, fail, getFunctionId, getFunctionResults, getMatchingRegexText, getParam, getParamLength, getParams, getParentTags, getSessionTag, getStoreToFileName, getStringOrDefault, getTestCaseTag, getVariable, getVariableAsBoolean, getVariableAsList, getVariableAsString, isBreakPoint, isContextVariableNull, pluginTearDown, recordFunctionResult, regexMatches, removeFunctionResult, removeVariable, setDefaultVariableValue, setDefaultVariableValue, setExpectException, setExpectFailure, setFunctionDelay, setFunctionId, setVariable, store, traceMsg, validate
 
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

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

script

protected File script
The script to execute

This attribute is recognized by Jameleon
Required: true

checkOutcomePassed

protected boolean checkOutcomePassed
Pass only if the script passed

This attribute is recognized by Jameleon

checkOutcomeFailed

protected boolean checkOutcomeFailed
Pass only if the script failed

This attribute is recognized by Jameleon

noTestCaseResults

protected boolean noTestCaseResults
TODO

This attribute is recognized by Jameleon

numOfFunctionsRun

protected int numOfFunctionsRun
The number of functional points that should be run from the script being executed

This attribute is recognized by Jameleon
Default Value: -1

numOfFailures

protected int numOfFailures
The number of failures that should fail from the script being executed

This attribute is recognized by Jameleon
Default Value: -1

noFailOnFunctionId

protected String noFailOnFunctionId
A functionId where no failure should occur

This attribute is recognized by Jameleon

numOfTestCasesRun

protected int numOfTestCasesRun
The number of test cases that should run from the script being executed (for when useCSV is set to true in the testcase tag)

This attribute is recognized by Jameleon
Default Value: -1

numOfTestCasesFailed

protected int numOfTestCasesFailed
The number of test cases that should fail from the script being executed (for when useCSV is set to true in the testcase tag)

This attribute is recognized by Jameleon
Default Value: -1

testCaseDocsFile

protected String testCaseDocsFile
The name of the generated test case doc file.

This attribute is recognized by Jameleon

executionTimeGreaterThan

protected int executionTimeGreaterThan
The execution time should be greater than this number if set

This attribute is recognized by Jameleon
Default Value: -1

executionTimeLessThan

protected int executionTimeLessThan
The execution time should be greater than this number if set

This attribute is recognized by Jameleon
Default Value: -1

lineNumFailed

protected int lineNumFailed
The line # of the script that is stated as failing in the HTML . This requires the testCaseName attribute be set

This attribute is recognized by Jameleon
Default Value: -1

lineFailedReason

protected String lineFailedReason
The given error message for failure in the HTML results

This attribute is recognized by Jameleon

lineFailedFunctionId

protected String lineFailedFunctionId
The functionId of the row that failed

This attribute is recognized by Jameleon

errorMsgContains

protected String errorMsgContains
A snippet of the error message or reason for that is expected in stdout.

This attribute is recognized by Jameleon

testCaseName

protected String testCaseName
A snippet of the error message or reason for that is expected in stdout.

This attribute is recognized by Jameleon

htmlResults

protected StringWriter htmlResults

timestampedResults

protected Writer timestampedResults

jmln

protected ExecuteTestCase jmln

denyAll

protected org.apache.log4j.varia.DenyAllFilter denyAll

parser

protected static org.dom4j.io.SAXReader parser

result

protected TestCaseResult result

originalCounter

protected TestCaseCounter originalCounter

stdOutWriter

protected Writer stdOutWriter

listener

protected TestCaseListener listener
Constructor Detail

ExecuteJameleonScriptTag

public ExecuteJameleonScriptTag()
Method Detail

testBlock

public void testBlock()
Description copied from class: FunctionTag
Contains the actual testing of the function point. Implement this method with any code that would make the FunctionTag unique. The default implementation does nothing. Implement this method to make your function tag useful.

Overrides:
testBlock in class FunctionTag

setupEnvironment

protected void setupEnvironment()
Description copied from class: FunctionTag
This method is called before anything else is called.

Overrides:
setupEnvironment in class FunctionTag

setup

public void setup()
Description copied from class: FunctionTag
Does setup for plugin-required intialization. Functional points that implement the plugin should call the super of method before implementing their own code.

Overrides:
setup in class FunctionTag

setUpFunctionResults

protected void setUpFunctionResults()
Overrides:
setUpFunctionResults in class FunctionTag

tearDown

public void tearDown()
Description copied from class: FunctionTag
Called when the function is done being executed. Use to clean up resources created in the setup method.

Overrides:
tearDown in class FunctionTag

executeScript

protected String executeScript()

assertFunctionIdNotFailed

protected void assertFunctionIdNotFailed(String noFailOnFunctionId)

assertOutcomeEquals

protected void assertOutcomeEquals(String expected)

assertOutcomePassed

protected void assertOutcomePassed()

assertOutcomeFailed

protected void assertOutcomeFailed()

assertNumOfFunctionsRun

protected void assertNumOfFunctionsRun(int expected)

assertNumOfFailures

protected void assertNumOfFailures(int expected)

assertNumOfTestCasesRun

protected void assertNumOfTestCasesRun(int expected)

assertNumOfTestCasesFailed

protected void assertNumOfTestCasesFailed(int expected)

assertTestCaseDocFileEndsWith

protected void assertTestCaseDocFileEndsWith(String expected)

assertExecutionTimeLessThan

protected void assertExecutionTimeLessThan(long lessThanTime)

assertExecutionTimeGreaterThan

protected void assertExecutionTimeGreaterThan(long greaterThanTime)

getOutcome

protected String getOutcome()

getFunctionsRun

protected List getFunctionsRun()

getTestCasesRun

protected int getTestCasesRun()

getTestCasesFailed

protected int getTestCasesFailed()

getExecutionTime

protected long getExecutionTime()

getTestCaseDocFile

protected String getTestCaseDocFile()

assertHtmlTestCaseName

protected void assertHtmlTestCaseName(String expected)

getHtmlDisplayedOutcome

protected String getHtmlDisplayedOutcome()

getHtmlDisplayedTestCaseName

protected String getHtmlDisplayedTestCaseName()

stripHtmlRow

protected String stripHtmlRow()

getRowFromHtml

protected String getRowFromHtml()

getValueFromElement

protected String getValueFromElement(String elementName,
                                     String message)

getHtmlDocument

protected org.dom4j.Document getHtmlDocument()

getDocument

protected org.dom4j.Document getDocument(StringWriter results)


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