1

my new problem is an if condition tags .

In fact, I can not get into the condition 'then' when "param" is 0.

<xmltask source="rapport.xml">                                      
    <call path="//testsuites">
        <param name="chaine" path="@name"/>
        <param name="testsuite1" path="testsuite[1]/@name"/>
        <param name="testsuite2" path="testsuite[2]/@name"/>                                
        <param name="ko1" path="count(testsuite[1]/testcase/failure[@type='ko'])"/>
        <actions>   
            <echo message="count fichiers ko 1 : @{ko1}"/>
            <if>
                <equals arg1="${ko1}" arg2="0" />
                <then>
                    <echo message="OK"/>
                </then>
                <else>                              
                    <echo message="KO"/>                            
                </else>
            </if>                           
        </actions>
    </call>                               
</xmltask>

Why I can not get into the "then" condition, but only in "else" while "arg1" = 0 ?

The rapport.xml is :

<testsuites name="COMPTES" tests="6" time="7" timestamp="2014-07-01T17-20-07" failures="6" errors="0">
    <testsuite name="100" tests="6" failures="6" errors="0" time="7">
        <testcase classname="Script.COMPTES.100" name="TEST1" time="1">
            <failure message="Not exist file or counter or used" type="fichiersInexistants">
                File No matches
            </failure>
        </testcase>
        <testcase classname="Script.COMPTES.100" name="TEST2" time="2">
            <failure message="Not exist file or counter or used" type="fichiersUtilises">
                Data set in use
            </failure>
        </testcase>
        <testcase classname="Script.COMPTES.100" name="TEST3" time="3">
            <failure message="Not exist file or counter or used" type="fichiersInexistants">
                File No matches
            </failure>
        </testcase>
        <testcase classname="Script.COMPTES.100" name="TEST4" time="3">
            <failure message="File abended" type="abended">
                File abended
            </failure>
        </testcase>
    </testsuite>
</testsuites>
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Show us your XML source means rapport.xml – Rebse Jul 07 '14 at 11:36
  • Manouti's answer is right. See xmltask documentation => http://www.oopsconsultancy.com/software/xmltask/ => "Note how the parameters are dereferenced in this example (using @{...}). Note also that for embedded actions each property must have a value assigned to it. If in doubt use the default attribute in the instruction." – Rebse Jul 07 '14 at 11:45

1 Answers1

0

Try using @{ko1} instead of ${ko1} to reference the parameter. If the echo is really printing 0, it should work.

<echo message="count fichiers ko 1 : @{ko1}"/>
<if>
    <equals arg1="@{ko1}" arg2="0" />
M A
  • 71,713
  • 13
  • 134
  • 174