Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3682072
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:45:18+00:00 2026-05-19T03:45:18+00:00

I have an ant task set up like so: <target name=unit-test description=unit tests depends=compile-tests>

  • 0

I have an ant task set up like so:

<target name="unit-test" description="unit tests" depends="compile-tests">
   <mkdir dir="${build}/test"/>
   <mkdir dir="${build}/test/raw"/>
   <mkdir dir="${build}/test/reports"/>

   <!-- set up scratch database for tests -->
   <mkdir dir="${build.dbTest}" />

  <junit printsummary="yes" haltonfailure="no" maxmemory="512m" >
   <classpath>
     <pathelement path="${java.class.path}"/>
     <pathelement path="${build.classes}"/>
     <pathelement path="${build.test-classes}"/>
     <fileset dir="lib" includes="*.jar"/>
     <fileset dir="lib-test" includes="*.jar"/>
   </classpath>
   <formatter type="xml"/>
   <sysproperty key="derby.system.home" value="${build.dbTest}" />
   <batchtest fork="yes" todir="${build}/test/raw">
     <fileset dir="${src.test}">
       <include name="**/*Test.java"/>
     </fileset>
   </batchtest>
 </junit>
  <junitreport todir="${build}/test">
   <fileset dir="${build}/test/raw"/>
   <report todir="${build}/test/reports"/>
 </junitreport>
</target>

Which works pretty well for running all my tests, but running all my tests really slows down my TDD Fail-Pass-Refactor groove. My full test suite takes about six minutes to run, which is way too long for quick response changes during TDD, especially since most of the time I only care about results from one test. The work flow I’d like to have would be

  1. create test for new feature/bug
  2. run only the new test (or at most only the test class I just modified)
  3. write some code
  4. iterate 2-3 until the new tests are passing
  5. run full set of tests to make sure nothing else broke
  6. plug any broken test into the 2-3 cycle above and repeat full cycle
  7. when all tests pass, declare victory.

TestNG seems to have capability for grouping tests, which seems ideal (I could have a “TDD” group for the tests I’m currently working with. Changing that when I start working on something is an acceptable level of manual configuration here), but I don’t want to switch test frameworks unless I absolutely have to. Is there any way to do something similar, or another way to achieve my desired work flow, using JUnit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:45:19+00:00Added an answer on May 19, 2026 at 3:45 am

    I use in my scripts instead of

    <include name="**/*Test.java"/>
    

    the snippet

    <include name="${test}"/>
    

    and set the property test to **/*Test.java earlier in the script. Now I can start ant, setting the property to a different value:

    ant test -Dtest=**/*AcceptanceTests.java
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what my build.xml file looks like: <project name=test xmlns:cpptasks=antlib:net.sf.antcontrib.cpptasks> <target name=build-native> <mkdir
I have a list of jars in an ant task like this.. <path id=lib.path.id>
We currently have an ant task that contains something similar to the following: <filelist
I have an Ant script that performs a copy operation using the 'copy' task
I want to use the FTP task in ant, and I have found the
I have an ant target that echo's the content of an eclipse .project file,
I have here a Windows distribution server that runs an ANT task to build
I have an ant task that executes some command on a list of files.
I have an Ant task to call a java process that takes a file
I have an ant task that contains javac task inside. It reports about error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.