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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:28:23+00:00 2026-05-26T23:28:23+00:00

For a customer we need to generate detailed test reports for integration tests which

  • 0

For a customer we need to generate detailed test reports for integration tests which not only show, that everything is green, but also what the test did. My colleagues and I are lazy guys and we do not want to hack spreadsheets or text documents.

For that, I think about a way to document the more complex integration tests with JavaDoc comments on each @Test annotated method and each test class. For the test guys it is a good help to see to which requirement, Jira ticket or whatever the test is linked to and what the test actually tries to do. We want to provide this information to our customer, too.

The big question now is: How can we put the JavaDoc for each method and each test class into the JUnit reports? We use JUnit 4.9 and Maven.

I know, that there is a description for each assertXXX(), but we really would need a nice HTML list as result or a PDF document which lists all classes and there documentation and below that all @Test methods and their description, the testing time, the result and if failed, the reason why.

Or is there another alternative to generate fancy test scripts? (Or should we start an OpenSource project on this!? 😉 )

Update:
I asked another question on how to add a RunListener to Eclipse to have it also report in Eclipse when started there. The proposed solution with a custom TestRunner is another possibility to have the test results report. Have a look: How can I use a JUnit RunListener in Eclipse?

  • 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-26T23:28:24+00:00Added an answer on May 26, 2026 at 11:28 pm

    One way to achieve this would be to use a custom RunListener, with the caveat that it would be easier to use an annotation rather than javadoc. You would need to have a custom annotation such as:

    @TestDoc(text="tests for XXX-342, fixes customer issue blahblah")
    @Test
    public void testForReallyBigThings() {
        // stuff
    }
    

    RunListener listens to test events, such as test start, test end, test failure, test success etc.

    public class RunListener {
        public void testRunStarted(Description description) throws Exception {}
        public void testRunFinished(Result result) throws Exception {}
        public void testStarted(Description description) throws Exception {}
        public void testFinished(Description description) throws Exception {}
        public void testFailure(Failure failure) throws Exception {}
        public void testAssumptionFailure(Failure failure) {}
        public void testIgnored(Description description) throws Exception {}
    }
    

    Description contains the list of annotations applied to the test method, so using the example above you can get the Annotation TestDoc using:

    description.getAnnotation(TestDoc.class);
    

    and extract the text as normal.

    You can then use the RunListener to generate the files you want, with the text specific to this test, whether the test passed or failed, or was ignored, the time taken etc. This would be your custom report.

    Then, in surefire, you can specify a custom listener, using:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.10</version>
      <configuration>
        <properties>
          <property>
            <name>listener</name>
            <value>com.mycompany.MyResultListener,com.mycompany.MyResultListener2</value>
          </property>
      </configuration>
    </plugin>
    

    This is from Maven Surefire Plugin, Using JUnit, Using custom listeners and reporters

    This solution has the disadvantage that you don’t have the flexibility of javadoc as far as carriage returns, formatting is concerned, but it does have the advantage that the documentation is in one specific place, the annotation TestDoc.

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

Sidebar

Related Questions

In the small application that I'm currently developing for a customer I need to
I need to create an API that will allow my customer's developers to use
I need to write a query that will generate a sort of sequenced ID
We need to generate LINQ queries which are 100% unknown during coding (design time).
I generate PDF's using FPDF and I need to email it to a customer.
I'm creating a reporting application, and our customers are going to need to generate
I need to profile a java application for a customer. It's an eclipse/maven project,
I need to write a little tool for a customer to be run on
I need to take production data with real customer info (names, address, phone numbers,
I need to calculate the age of a customer from their date of birth.

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.