net.sf.jameleon.plugin.htmlunit.tags
Class HtmlUnitValidateTag

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.htmlunit.HtmlUnitFunctionTag
                      extended by net.sf.jameleon.plugin.htmlunit.tags.HtmlUnitValidateTag
All Implemented Interfaces:
BreakPoint, Attributable, Storable, DynaTag, LocationAware, Tag

public class HtmlUnitValidateTag
extends HtmlUnitFunctionTag

A generic validate tag used to validate HTML. If no attributes are set, then no validation occurs. If no validation occurs, then this tag will fail.
To validate a page with the title Yo World!:


     <htmlunit-validate
            functionId="Verify that the title is 'Yo World!'"
            title="Yo World!"/>
 
If you want a better error message when a failure occurs, then pass in the msg attribute.

     <htmlunit-validate
            functionId="Verify that the title is 'Yo World!'"
            title="Yo World!"
            msg="We must be on the wrong page."/>
 
If you want validate that some text simple exists on the page anywhere:

     <htmlunit-validate
            functionId="Verify that 'some text' exists on the current page"
            textPresent="some text"/>
 
If you want to use xpath to validate, then simply use the xpath attribute:

     <htmlunit-validate
            functionId="Verify that 'some text' exists on the current page"
            xpath="//body/table[2]/tr[@id='checking_account' and text=()='234333433']"/>
 
You can, supply multiple attributes. If you supply multiple attributes and the msg attribute, then the msg will be used on any failure.

Tag Name: <htmlunit-validate> Type: validation

Field Summary
protected  String msg
          The message to display in if a failure occurs
protected  String textPresent
          The expected text in the page
protected  String title
          The expected title of the page
protected  String xpath
          The xpath to evaluate
 
Fields inherited from class net.sf.jameleon.plugin.htmlunit.HtmlUnitFunctionTag
helper, sessionTag, workingForm
 
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
HtmlUnitValidateTag()
           
 
Method Summary
 void testBlock()
           
 
Methods inherited from class net.sf.jameleon.plugin.htmlunit.HtmlUnitFunctionTag
assertTextPresent, assertTextPresent, assertTextPresent, assertTextPresent, assertTitleEquals, assertTitleEquals, assertTitleEquals, assertTitleEquals, assertXPathMatches, assertXPathMatches, assertXPathMatches, assertXPathMatches, clickElementWithXPath, getHtmlElementByAttributeNameAndValue, getHtmlElementByXPath, getHtmlForm, getHtmlFormById, getHtmlFormByIndex, getHtmlFormByName, getHtmlFormByXPath, getWorkingForm, navigate, setCheckBox, setCheckBox, setFileField, setHiddenField, setHtmlInputValue, setHtmlInputValueByXPath, setPasswordField, setRadioButton, setSelectFieldByIndex, setSelectFieldByOptionText, setSelectFieldByValue, setSelectFieldByXPath, setTextArea, setTextField, setupEnvironment, setWorkingForm, setWorkingFormById, setWorkingFormByIndex, setWorkingFormByName, setWorkingFormByXPath, store
 
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, setup, setUpFunctionResults, setVariable, tearDown, 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

title

protected String title
The expected title of the page

This attribute is recognized by Jameleon

textPresent

protected String textPresent
The expected text in the page

This attribute is recognized by Jameleon

xpath

protected String xpath
The xpath to evaluate

This attribute is recognized by Jameleon

msg

protected String msg
The message to display in if a failure occurs

This attribute is recognized by Jameleon
Constructor Detail

HtmlUnitValidateTag

public HtmlUnitValidateTag()
Method Detail

testBlock

public void testBlock()
Overrides:
testBlock in class FunctionTag


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