DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • The Hidden Engineering Cost of XML in Enterprise Development Workflows
  • Introduction to Data-Driven Testing With JUnit 5: A Guide to Efficient and Scalable Testing
  • How to Convert XLS to XLSX in Java
  • Why Testing is a Long-Term Investment for Software Engineers

Trending

  • Adding Graph Retrieval to a RAG Pipeline With Python
  • Build a Voice Assistant With Gemini Live API
  • Testing Java and Spring Applications With Kotlin: Low-Risk to Adoption
  • How an AI Software Factory Works: From Developer Intent to Production

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Java
  4. Viewing JUnit XML Files Locally

Viewing JUnit XML Files Locally

In this tutorial, you'll learn how to view the contents of a JUnit XML file locally and read its contents in the form of a table.

By 
Matthew Casperson
·
Oct. 09, 17 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
30.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In order to allow Iridium to be integrated into CI systems, one of the report files that is generated is a JUnit XML file. Almost every CI has a plugin that can parse a JUnit XML file, but sometimes it is nice to be able to view the contents of this file locally.

The trouble is that this file is not that easy to read in its raw form. You can find what you need if you dig into the format, but I’d still rather have this information presented in a nice table.

Fortunately, there are some open source tools you can use to quickly browse the contents of a JUnit XML file.

First, you will need a JUnit XML file to view. Install Java 8, download the WebStart file from this link and run the file to execute a simple test. The results of the test will be saved to ~/WebAppTestingReports/<yyMMdd>/MergedResults.xml. You should see a file like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testsuite failures="0" skipped="0" tests="1" time="56.422665">
    <testcase classname="Google Test" name="1: Launch Google" time="56.422665">
        <system-out>Given I open the page "https://google.com"..................................passed
When the element found by "Google Search" is present........................passed
Then the browser title should be "Google"...................................passed
</system-out>
    </testcase>
</testsuite>

Then you will need to install junit-viewer, which is built on top of NodeJS. This app will convert the JUnit XML file into HTML.

sudo npm install junit-viewer -g

Next, you need to install bcat, which is a Ruby Gem that can be used to pipe HTML directly to the browser.

sudo gem install bcat

Finally, these two tools can then be combined to display the JUnit XML file directly in the browser. 

junit-viewer --results=MergedReport.xml | bcat

Image title

If you are interested in writing end-to-end tests like the one shown above, check out the Iridium documentation, and take a look at the course on Udemy. Iridium itself is a free and open source project on GitHub.

XML JUnit

Opinions expressed by DZone contributors are their own.

Related

  • The Hidden Engineering Cost of XML in Enterprise Development Workflows
  • Introduction to Data-Driven Testing With JUnit 5: A Guide to Efficient and Scalable Testing
  • How to Convert XLS to XLSX in Java
  • Why Testing is a Long-Term Investment for Software Engineers

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook