AW: How to run a single junit test method with ant

2013-05-11 Thread jhm
Basic idea is
- specify the test to run via command line property (-Dtestcase=...)
- test-targets depends on two targets running a single test or the whole test 
suite
   
- that two targets are conditional according to that property
   
   

Jan

> -Ursprüngliche Nachricht-
> Von: Matt Benson [mailto:gudnabr...@gmail.com]
> Gesendet: Freitag, 10. Mai 2013 16:55
> An: Ant Users List
> Betreff: Re: How to run a single junit test method with ant
> 
> Typically this would be done using separate targets.  Ant's own
> build.xml provides an example.
> 
> HTH,
> Matt
> 
> 
> On Thu, May 9, 2013 at 11:33 PM, 肖谋  wrote:
> 
> > Hi, Users.
> >I am using ant in Linux. I can use ant junit task to run all test
> > methods in a junit4 test class but fail to find the way to  run a
> > single test method.  I googled and found a helpful article at
> > https://today.java.net/pub/a/today/2003/09/12/individual-test-
> cases.html.
> > However, the solution it provides does not help. My ant seems not to
> > recognize the "tests" sysproperty.
> >   My ant version is 1.8.4. and the related content of build.xml is
> > listed as follows:
> >
> >
> > 
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> >   Please help! Thanks a lot!
> >
> > Regards
> > xiaomou
> >


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



Re: How to run a single junit test method with ant

2013-05-11 Thread 肖谋
Thanks for your reply. Perhaps I did not express my problem clearly, or may
not understand your solution.
My problem is : I have junit test class:
class TestService {
  @Test
   void test1() {}
  @Test
   void test2() {}
}

now I'd like to only test the "test2" with ant command line like this:
ant -Dtest=TestService -Dtestcase=test2 test-target
Then how to write the build.xml?

Thanks


XiaoMou





On Sat, May 11, 2013 at 4:00 PM, Jan Matèrne (jhm) 
 wrote:

> Basic idea is
> - specify the test to run via command line property (-Dtestcase=...)
> - test-targets depends on two targets running a single test or the whole
> test suite
>
> - that two targets are conditional according to that property
>
>
>
> Jan
>
> > -Ursprüngliche Nachricht-
> > Von: Matt Benson [mailto:gudnabr...@gmail.com]
> > Gesendet: Freitag, 10. Mai 2013 16:55
> > An: Ant Users List
> > Betreff: Re: How to run a single junit test method with ant
> >
> > Typically this would be done using separate targets.  Ant's own
> > build.xml provides an example.
> >
> > HTH,
> > Matt
> >
> >
> > On Thu, May 9, 2013 at 11:33 PM, 肖谋  wrote:
> >
> > > Hi, Users.
> > >I am using ant in Linux. I can use ant junit task to run all test
> > > methods in a junit4 test class but fail to find the way to  run a
> > > single test method.  I googled and found a helpful article at
> > > https://today.java.net/pub/a/today/2003/09/12/individual-test-
> > cases.html.
> > > However, the solution it provides does not help. My ant seems not to
> > > recognize the "tests" sysproperty.
> > >   My ant version is 1.8.4. and the related content of build.xml is
> > > listed as follows:
> > >
> > >
> > > 
> > > 
> > >
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > >   Please help! Thanks a lot!
> > >
> > > Regards
> > > xiaomou
> > >
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>