[Webtest] macrodef

Mark McKeown Mark McKeown <Mark.McKeown@aepona.com>
Tue, 09 Jan 2007 13:00:40 +0000


Guys,

I have a macrodef:

<macrodef name="verifyMacro">
     <attribute name="count" default="0"/>
     <attribute name="breadcrumb1" default="X"/>
     <attribute name="breadcrumb2" default="X"/>
     <attribute name="breadcrumb3" default="X"/>
     <attribute name="breadcrumb4" default="X"/>

     <sequential>

     <ifStep description="breadcrumb has 3 values">
         <condition>
             <verifyProperty name="count" value="3"/>
         </condition>
         <verifyXPath description="Check breadcrumbs"
             xpath="//div[@id='breadcrumbs']"
             text="${breadcrumb1} >> ${breadcrumb2} >> ${breadcrumb3}"/>
     </ifStep>

     <ifStep description="breadcrumb has 4 values">
         <condition>
             <verifyProperty name="count" value="0"/>
         </condition>
         <verifyXPath description="Check breadcrumbs"
             xpath="//div[@id='breadcrumbs']"
             text="${breadcrumb1} >> ${breadcrumb2} >> ${breadcrumb3} >> ${breadcrumb4}"/>
     </ifStep>

     </sequential>

</macrodef>


and I call it using:


<verifyMacro
         count="3"
         breadcrumb1="${menu1}"
         breadcrumb2="${menu2}"
         breadcrumb3="${menu3}"
         breadcrumb4=""/>

The purpose of my macrodef is to check the breadcrumbs in my page. If I set count="3" then I have 3 values in my 
breadcrumbs and I expect the <condition> in my first <ifStep> to be true and execute the step to verify the 3 values in 
my breadcrumbs. However the <condition> in my <ifStep> does not appear to be tested?? I think this is because "count" is 
probably not a "property" as such.

Can anyone suggest a way that I can test what value "count" is set to and thus execute the correct part of my macrodef?

Thanks in adavance,
Mark