This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi, I want to add a new attribute lets say category into the Junit task, which has other attributes like fork,haltonerror etc., I want to add this attribute and provide implementation to it, any idea which all source codes I should dig, I am using junit4.0, junit-ext-0.2.4. 1.)Is there a code or configuration in ANT which has list of all attributes of a task. 2.)For providing implementation to the new attribute in the junit task, do I need to modify the JunitTask, JunitRunner and classes of ant-junit. Any good idea will be highly appreciated.
Each attribute of an ant task is stored in a field of the class that implements that ant task. So what you would want to do is find the class that implements the junit ant task, extend it, and add a field for your attribute. Then what you do with that attribute value is up to you.
Here's the source to a test task I wrote a while ago. It has a single attribute "arg1" for which a setter method needs to be provided. It also shows how to retrieve a property from the build file, and various calls to the project environment. You'd use it with <MyTask arg1="foobar"/>.
[ July 01, 2008: Message edited by: Ulf Dittmer ]
Joined: Jun 19, 2008
Thanks Peter & Ulf, those nuggets are really helpful..