question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Java JUnit support

See original GitHub issue

Tracking issue for JUnit support.

Experimental support was added in v1.3.0 with java-junit reporter. Implementation is based on test result files taken from lhotari/pulsar.

Due to lack of my own experience/interest with Java ecosystem no java project to create test fixtures was added. There is also no documentation how to use JUnit to get XML with results - I expect there is plenty of other resources about this topic.

@lhotari Here you can see how it looks: https://github.com/dorny/pulsar/runs/2052225393?check_suite_focus=true My setup is based on your lh-refactor-pulsar-ci-with-retries branch. By purpose I made one test fail to verify failure annotations are working. I also modified CI workflow to upload merged-test-report.xml instead of XML per test class. It works both ways but with XML per test class approach you get more noise in the report. I’ve also noticed there are some duplicates. Multiple test results with same name are also present in XML so it’s probably not a bug. Still I’m not sure why is that and If I should handle it in some specific way. Please keep me updated how it works for you.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
omBrattengcommented, Sep 7, 2021
0reactions
Gakkcommented, Jun 24, 2021

First; thanks for a great action helping us migrate to GitHub 😃👍

We are using NUnit with its output transformation to get JUnit-style results. But when a test fails I don’t get the failure message anywhere in your generated report, just first line/item of the stack trace.

Is there a way, when a message is present, to have the message-attribute show as the error text, and put the complete stack trace under Raw output and Show more?

NOTE: I am parsing with java-junit, as jest-junit fails with an error: image

Test result XML:

<testcase name="SearchStreetsWithFilterNoHit" assertions="0" time="0.008161" status="Failed" classname="MyAppName.Client.Adapters.MapAdapter.MapAddressSearchTest">
  <failure message="System.IO.DirectoryNotFoundException : Could not find language resources for neither given culture 'nb-NO' or fallback 'en-US'.">   at MyAppName.Client.Adapters.MapAdapter.MapNavigation..ctor(IMapAdapter mapAdapter, ApplicationViewModel applicationViewModel) in C:\actions-runner\_work\MyAppName7\MyAppName7\MyAppName.Client\src\Adapters\MapAdapter\MapNavigation.cs:line 337
   at MyAppName.Client.Adapters.MapAdapter.MapBaseTest.Setup() in C:\actions-runner\_work\MyAppName7\MyAppName7\MyAppName.Client\src\Adapters\MapAdapter\MapBaseTest.cs:line 34</failure>
</testcase>

GitHub action report:

❌ SearchStreetsWithFilterNoHit
	at MyAppName.Client.Adapters.MapAdapter.MapNavigation..ctor(IMapAdapter mapAdapter, ApplicationViewModel applicationViewModel) in C:\actions-runner\_work\MyAppName7\MyAppName7\MyAppName.Client\src\Adapters\MapAdapter\MapNavigation.cs:line 337

GitHub code annotation:

Clicking “Raw output” shows the rest of the stack trace: image

GitHub action annotation:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit 5
The 5th major version of the programmer-friendly testing framework for Java and the JVM. User Guide · Javadoc · Code & Issues ·...
Read more >
JUnit Tutorial - Tutorialspoint
JUnit Tutorial, JUnit is a unit testing framework for Java programming language. JUnit has been important in the development of test-driven development, ...
Read more >
A Guide to JUnit 5 - Baeldung
JUnit is one of the most popular unit-testing frameworks in the Java ecosystem. The JUnit 5 version contains a number of exciting ...
Read more >
JUnit Tutorial: Setting Up, Writing, and Running Java Unit Tests
JUnit is the most popular Java unit testing framework. An open-source framework, it's used to write and run repeatable automated tests.
Read more >
JUnit 5 | IntelliJ IDEA Documentation - JetBrains
Select New Project. Specify the name for the project, for example, junit-tutorial . Select Maven as a build tool. In Language, select Java....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found