You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by mayurs <ss...@gmail.com> on 2007/08/28 02:07:54 UTC

ant junit task...

Hi All 

I have this Junit task in my build.xml file, 

        <junit>
          <classpath refid="junit.run.id"/>
          <formatter type="brief" usefile="false" />
             <fileset dir="${junitclasses.dir}" includes="**/Test*.class"/> 
        </junit>

The problem is this wilcard for includes above will run all Junit Test
classes that I have , including some inner class. 

How do I tell Junit ant task, to skip inner classes from a specific
directory? 

I read somewhere that junit 4.4 has some support for this? Can someone let
me know how to skip inner classes from being run by junit ant task?

tx
Mayur
-- 
View this message in context: http://www.nabble.com/ant-junit-task...-tf4339046.html#a12359955
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


Re: ant junit task...

Posted by mayurs <ss...@gmail.com>.
I know of the excludes attribute the issue, is, lets say I have a class
TestFoo.class and TestFoo$abc.class

I am only concerned about running TestFoo.class , but if I have this,

<fileset dir="${junitclasses.dir}" includes="**/Test*.class"
excludes="**/$*.class"/>

This does not work, since includes attribute, above will include the inner
class as well, so excludes attribute does not work


tx
Mayur


Jerome Jar-2 wrote:
> 
> Hi, Mayur,
> 
> I think you can make use of the "excludes" attribute of the fileset.
> Inner classes have at least one "$" marks in the names of their class
> files.
> 
> Regards,
> Jerome.
> 
> On 8/28/07, mayurs <ss...@gmail.com> wrote:
>>
>> Hi All
>>
>> I have this Junit task in my build.xml file,
>>
>>         <junit>
>>           <classpath refid="junit.run.id"/>
>>           <formatter type="brief" usefile="false" />
>>              <fileset dir="${junitclasses.dir}"
>> includes="**/Test*.class"/>
>>         </junit>
>>
>> The problem is this wilcard for includes above will run all Junit Test
>> classes that I have , including some inner class.
>>
>> How do I tell Junit ant task, to skip inner classes from a specific
>> directory?
>>
>> I read somewhere that junit 4.4 has some support for this? Can someone
>> let
>> me know how to skip inner classes from being run by junit ant task?
>>
>> tx
>> Mayur
>> --
>> View this message in context:
>> http://www.nabble.com/ant-junit-task...-tf4339046.html#a12359955
>> 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
>>
>>
> 
> 
> -- 
> "Houston, we have a problem."
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ant-junit-task...-tf4339046.html#a12371822
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


Re: ant junit task...

Posted by Jerome Jar <iu...@gmail.com>.
Hi, Mayur,

I think you can make use of the "excludes" attribute of the fileset.
Inner classes have at least one "$" marks in the names of their class
files.

Regards,
Jerome.

On 8/28/07, mayurs <ss...@gmail.com> wrote:
>
> Hi All
>
> I have this Junit task in my build.xml file,
>
>         <junit>
>           <classpath refid="junit.run.id"/>
>           <formatter type="brief" usefile="false" />
>              <fileset dir="${junitclasses.dir}" includes="**/Test*.class"/>
>         </junit>
>
> The problem is this wilcard for includes above will run all Junit Test
> classes that I have , including some inner class.
>
> How do I tell Junit ant task, to skip inner classes from a specific
> directory?
>
> I read somewhere that junit 4.4 has some support for this? Can someone let
> me know how to skip inner classes from being run by junit ant task?
>
> tx
> Mayur
> --
> View this message in context: http://www.nabble.com/ant-junit-task...-tf4339046.html#a12359955
> 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
>
>


-- 
"Houston, we have a problem."

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


Re: ant junit task...

Posted by Bruce Atherton <br...@callenish.com>.
It may be including it, but it isn't because of the includes attribute. 
All excludes happen AFTER the includes when dealing with PatternSets, 
which the FileSet is creating for you with its includes and excludes 
parameters.

You can test this with a simple build script:

<project name="Test Patternsets" default="test" basedir=".">
  <property name="src" location="src"/>
  <property name="dest" location="dest"/>

  <target name="test">
    <mkdir dir="${dest}"/>
    <copy todir="${dest}">
      <fileset dir="${src}" includes="*$*" excludes="*.txt" />
    </copy>
  </target>

</project>

Put a bunch of files in a src subdirectory, some containing a "$" and 
ending in "txt", others containing a "$" but with a different extension. 
Only the latter will be copied over to the dest directory, even though 
the includes says any filename that contains a "$" should be copied.

Perhaps you could show exactly how you have defined your junit task in 
your latest test. There may be another issue with it.

mayurs wrote:
> I also tried excludes="**/*$*.class, same result, it includes the inner
> classes as well , due to the includes attribute
>
>
> Jan.Materne wrote:
>   
>> first thought: the missing * before the $ in your exclude clause. 
>>
>> <fileset dir="${junitclasses.dir}" includes="**/Test*.class"
>> excludes="**/*$*.class"/>
>>
>>
>>
>> Jan
>>
>>     
>>> -----Ursprüngliche Nachricht-----
>>> Von: mayurs [mailto:ssmayur@gmail.com] 
>>> Gesendet: Dienstag, 28. August 2007 18:55
>>> An: user@ant.apache.org
>>> Betreff: Re: ant junit task...
>>>
>>>
>>> I know of the excludes attribute the issue, is, lets say I have a class
>>> TestFoo.class and TestFoo$abc.class
>>>
>>> I am only concerned about running TestFoo.class , but if I have this,
>>>
>>> <fileset dir="${junitclasses.dir}" includes="**/Test*.class"
>>> excludes="**/$*.class"/>
>>>
>>> This does not work, since includes attribute, above will 
>>> include the inner
>>> class as well, so excludes attribute does not work
>>>
>>>
>>> tx
>>> Mayur
>>>
>>>
>>> Jerome Jar-2 wrote:
>>>       
>>>> Hi, Mayur,
>>>>
>>>> I think you can make use of the "excludes" attribute of the fileset.
>>>> Inner classes have at least one "$" marks in the names of their class
>>>> files.
>>>>
>>>> Regards,
>>>> Jerome.
>>>>
>>>> On 8/28/07, mayurs <ss...@gmail.com> wrote:
>>>>         
>>>>> Hi All
>>>>>
>>>>> I have this Junit task in my build.xml file,
>>>>>
>>>>>         <junit>
>>>>>           <classpath refid="junit.run.id"/>
>>>>>           <formatter type="brief" usefile="false" />
>>>>>              <fileset dir="${junitclasses.dir}"
>>>>> includes="**/Test*.class"/>
>>>>>         </junit>
>>>>>
>>>>> The problem is this wilcard for includes above will run all 
>>>>>           
>>> Junit Test
>>>       
>>>>> classes that I have , including some inner class.
>>>>>
>>>>> How do I tell Junit ant task, to skip inner classes from a specific
>>>>> directory?
>>>>>
>>>>> I read somewhere that junit 4.4 has some support for this? 
>>>>>           
>>> Can someone
>>>       
>>>>> let
>>>>> me know how to skip inner classes from being run by junit ant task?
>>>>>
>>>>> tx
>>>>> Mayur
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/ant-junit-task...-tf4339046.html#a12359955
>>>>> 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
>>>>>
>>>>>
>>>>>           
>>>> -- 
>>>> "Houston, we have a problem."
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> -- 
>>> View this message in context: 
>>> http://www.nabble.com/ant-junit-task...-tf4339046.html#a12371822
>>> 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
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>     
>
>   

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


Re: AW: ant junit task...

Posted by mayurs <ss...@gmail.com>.
I also tried excludes="**/*$*.class, same result, it includes the inner
classes as well , due to the includes attribute


Jan.Materne wrote:
> 
> first thought: the missing * before the $ in your exclude clause. 
> 
> <fileset dir="${junitclasses.dir}" includes="**/Test*.class"
> excludes="**/*$*.class"/>
> 
> 
> 
> Jan
> 
>>-----Ursprüngliche Nachricht-----
>>Von: mayurs [mailto:ssmayur@gmail.com] 
>>Gesendet: Dienstag, 28. August 2007 18:55
>>An: user@ant.apache.org
>>Betreff: Re: ant junit task...
>>
>>
>>I know of the excludes attribute the issue, is, lets say I have a class
>>TestFoo.class and TestFoo$abc.class
>>
>>I am only concerned about running TestFoo.class , but if I have this,
>>
>><fileset dir="${junitclasses.dir}" includes="**/Test*.class"
>>excludes="**/$*.class"/>
>>
>>This does not work, since includes attribute, above will 
>>include the inner
>>class as well, so excludes attribute does not work
>>
>>
>>tx
>>Mayur
>>
>>
>>Jerome Jar-2 wrote:
>>> 
>>> Hi, Mayur,
>>> 
>>> I think you can make use of the "excludes" attribute of the fileset.
>>> Inner classes have at least one "$" marks in the names of their class
>>> files.
>>> 
>>> Regards,
>>> Jerome.
>>> 
>>> On 8/28/07, mayurs <ss...@gmail.com> wrote:
>>>>
>>>> Hi All
>>>>
>>>> I have this Junit task in my build.xml file,
>>>>
>>>>         <junit>
>>>>           <classpath refid="junit.run.id"/>
>>>>           <formatter type="brief" usefile="false" />
>>>>              <fileset dir="${junitclasses.dir}"
>>>> includes="**/Test*.class"/>
>>>>         </junit>
>>>>
>>>> The problem is this wilcard for includes above will run all 
>>Junit Test
>>>> classes that I have , including some inner class.
>>>>
>>>> How do I tell Junit ant task, to skip inner classes from a specific
>>>> directory?
>>>>
>>>> I read somewhere that junit 4.4 has some support for this? 
>>Can someone
>>>> let
>>>> me know how to skip inner classes from being run by junit ant task?
>>>>
>>>> tx
>>>> Mayur
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/ant-junit-task...-tf4339046.html#a12359955
>>>> 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
>>>>
>>>>
>>> 
>>> 
>>> -- 
>>> "Houston, we have a problem."
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>> 
>>> 
>>> 
>>
>>-- 
>>View this message in context: 
>>http://www.nabble.com/ant-junit-task...-tf4339046.html#a12371822
>>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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ant-junit-task...-tf4339046.html#a12388322
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