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

  • Home
  • SEARCH
  • 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 8616105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:32:20+00:00 2026-06-12T05:32:20+00:00

I have a test setup for a cloud system that uses a mixture of

  • 0

I have a test setup for a cloud system that uses a mixture of python for process level control and junit for internal state inspection. Essentially, I bring up several VMs to server as the cloud and then a junit VM which is a member of the cloud but drives tests and checks internal state. Our existing cloud management stuff is driven by python and I would like to maintain this.

I have a working setup that will run the JUnit command line via

java -ea -cp <classpath> org.junit.runner.JUnitCore <tests>

but this does not produce an report file. I know that ant is capable of producing an xml report, but I do not want to involve ant in this process (I have enough moving parts already).

Is there a way to launch junit from the command line such that it produces a report?

Ideally, I would have the junit tests produce xml reports, the python tests produce xml reports, and then merge them together for consumption by our CI system.

Update: The command line execution must support Windows, Linux, and Mac. We are not allowed to ship an external ant, although packaging an internal ant might be an option.

  • 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-06-12T05:32:22+00:00Added an answer on June 12, 2026 at 5:32 am

    The JUnit library does not have any XML output options. To achieve such a thing, you’ll need to write your own RunListener, which listens for the output and will in your case write the XML file.

    However, to get the XML file in the correct format so that it can be read by CI system, I think it would be far easier to just use ant, either via the command line using a build.xml (JUnitReport), or using the java api: How can i use Apache ANT Programmatically.

    EDIT: Initially, we had four options:

    1. Use ant from the command line
    2. Use ant programmatically (using the Java API)
    3. Use the XMLJUnitResultFormatter directly with JUnitCore
    4. Create a custom RunListener which produces the correct XML output.

    Given the restrictions added by the OP, we can’t use ant from the command line, which eliminates 1.

    After looking more closely at the Ant JUnit task, it seems to be impossible to use this with JUnitCore (adding a TestListener), because ant uses the name of the test class directly, so you can’t do a bridge class. From XMLJUnitResultFormatter.java

    private void formatError(String type, Test test, Throwable t) {
        ...
        nested.setAttribute(ATTR_TYPE, t.getClass().getName());
    
        String strace = JUnitTestRunner.getFilteredTrace(t);
        Text trace = doc.createTextNode(strace);
        nested.appendChild(trace);
    }
    

    This eliminates 3.

    Invoke Ant programmatically, via the Java API. I can’t find any recent documentation on this. This seems to be hard.

    So, finally, I would do 4, a custom RunListener, using the code from XMLJUnitResultFormatter as a base. And then, I’d publish it on github.com, so this question could be answered properly 🙂

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

Sidebar

Related Questions

I have setup an android test project that runs junit tests. It's using two
I have a ubr file setup to stress test an internal DotNetNuke site with
I have a test setup where I have many very similar unit tests that
I have some expensive test setup that is only necessary for a handful of
I have an test server setup that is running a version of the site
I have a very basic JNA test setup that I want to use to
Ok, I have an Nunit test class setup that runs though a method, lets
I want to have a good test setup but, I can't find a way
I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c
Suppose I have several small test cases. Easy enough to setup and easy enough

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.