You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Leif Ershag <le...@ershag.se> on 2010/07/26 13:11:10 UTC

Re: How to test a junit test case against multiple value of a property

On Mon, Jul 26, 2010 at 12:50 PM, shailja kumari <sh...@gmail.com>wrote:

>
> Hi All,
>
> I've got a class whose behavior changes based on a boolean property. This
> property is read in the static block of the class. Is there a way to write
> test JUnit testcase that can verify the behavior of the class for both the
> values of this property? If I specify the value in build.xml, I can test my
> code for only one value of the property.
>
>
This is more of a testing-question than an ant-question. The correct thing
to do is to extract the property to an external class and then build two
tests that mocks that class with each value.

Also question your design-decision to use static blocks... ;)


> How can I test on multiple value of a property ?
>
>  Thanks
> ~Shailja
>
>

Re: How to test a junit test case against multiple value of a property

Posted by shailja kumari <sh...@gmail.com>.
Used testing framework is Junit with Ant, that's the reason of this post. 
Thanks in advance for further help.

>>
extract the property to an external class and then build two 
tests that mocks that class with each value. 
>>

I passed the value of class property to Ant junit task like this

 <property name="JUNIT_PROPERTY.a.b.c"
              value="true" />


<junit>
------
------
 <syspropertyset>
             <propertyref prefix="JUNIT_PROPERTY." />
                <mapper type="glob" from="JUNIT_PROPERTY.*" to="*" />
            </syspropertyset>
</junit>

How can I test my test case on "true" as well as " false" value with the
help of JUNIT_PROPERTY.a.b.c.


-- 
View this message in context: http://ant.1045680.n5.nabble.com/How-to-test-a-junit-test-case-against-multiple-value-of-a-property-tp2227867p2227908.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org