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 4230704
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:53:35+00:00 2026-05-21T01:53:35+00:00

I tried to write an ant with JUnit test, but get below result: unittest:

  • 0

I tried to write an ant with JUnit test, but get below result:

unittest:
    [junit] Running com.mytest.utiltest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Test com.mytest.utiltest FAILED

it just shows error without print details, I specify below parameter in build.xml
also tried to start with ant -v or ant -debug, but did not get any luck. Can anyone help?

<junit printsummary="yes" showoutput="true">

ant 1.8.2, sun jdk1.6.0_20, junit 4.8.2

to narrow down the problem, I created a seperate project
this is my build.xml

<project name = "TestPrj" default="unittest" basedir = ".">

    <target name="unittest" >
        <junit printsummary="yes" showoutput="true" >
            <classpath>
                <pathelement location="./junit-4.8.2.jar"/>
                <pathelement location="./ant-junit4.jar"/>
            </classpath>
            <test name = "com.mytest.unittest.SimpleTest" todir="."/>
        </junit>
    </target>

</project>

below is simpletest.java

package com.mytest.unittest;

import junit.framework.TestCase;


public class SimpleTest extends TestCase{
    public void testFirst()
    {
        assertTrue(true);
    }

}

C:\TestPrj>ant

Buildfile: C:\TestPrj\build.xml

unittest:
    [junit] Running com.mytest.unittest.SimpleTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

BUILD SUCCESSFUL
Total time: 0 seconds

C:\TestPrj>dir

 Directory of C:\TestPrj

04/02/2011  02:00 PM    <DIR>          .
04/02/2011  02:00 PM    <DIR>          ..
04/02/2011  01:56 PM               280 .classpath
04/02/2011  01:54 PM               519 .project
04/02/2011  02:00 PM             7,120 ant-junit4.jar
04/02/2011  02:00 PM               403 build.xml
04/02/2011  01:55 PM    <DIR>          com
11/17/2010  05:36 PM           237,344 junit-4.8.2.jar
               5 File(s)        245,666 bytes
               3 Dir(s)  28,451,311,616 bytes free

Why there’s not a JUnit results/detail/report generated?
So that in my real case of failure, i can not troubleshoot my questions?

  • 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-21T01:53:35+00:00Added an answer on May 21, 2026 at 1:53 am

    You have to use a formatter element inside the junit task. The formatter will create a report file by default, but you can force it to print the results on screen. You can use two formatters: one for output to screen, another for output to file.

    Note that you no longer need the attributes printsummary="yes" and showoutput="true" in the junit task. The formatter is taking care of output now.

    <project name = "TestPrj" default="unittest" basedir = ".">
    
    <target name="unittest" >
        <junit>
            <classpath>
                <pathelement location="./junit-4.8.2.jar"/>
                <pathelement location="./ant-junit4.jar"/>
            </classpath>
            <formatter type="plain" usefile="false" /> <!-- to screen -->
            <formatter type="plain" /> <!-- to file -->
            <test name = "com.mytest.unittest.SimpleTest" todir="."/>
        </junit>
    </target>
    
    </project>
    

    Read the junit page in the ant manual for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to write a Neural Network system, but even running through simple AND/OR/NOR
I tried to write a program that uses threads, but couldn't understand the o/p.
I tried to write a Taylor series expansion for exp(x)/sin(x) using fortran, but when
I put up an Ant project which includes a unit test using JUnit. The
I am configuring JUnit in Ant so that unit tests will be run on
I tried to write a function, that get a number of candidates betwen 10
I tried to write a simple google map application to display simple map but
I tried to write a Utility Manager application, and I am trying to test
I tried to write a countingsort, but there's some problem with it. here's the
I've tried to write the recursive Ackermann function in Java. But I think I've

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.