The JUnit report shows the names of the test methods in its report. Is there a way to provide some kind of description for the method (without using a huge descriptive name), so that the description shows up on the report?
I am using JUnit 4.11 (4.12 is still beta!)
Related
I have a project for which I need to gather all Tests in one Testsuite without referencing all the Testclasses. I tried using the #SelectPackages Annotation for the test package. However I have a multi module project and it gathers all Tests of all projects. Is there a better way to do this?
I am currently exporting my jUnit test results to Xray via REST API V2.
All is fine and as expected, except when a test fails there is no error logged, the Output field is blank:
I am importing the jUnit xml file after running Android tests. I have not modified it. It's a typical jUnit xml file.
Is there an additional step required in order to get the error message to display in the execution details ticket?
Thanks in advance.
The JUnit XML is a "de facto standard" but there is no accurate specification for it. Different frameworks may produce slightly different XML reports.
In Xray for Jira server/DC, how Xray processes the JUnit XMl report is described, at least to a certain point, here.
There may be some limitations though. One of them is related to the "message" attribute on the element; as of v4.x, is is not processed as detailed here.
On the concrete problem you reported, that seems to be related to the presence of "type" attribute, that is currently required.
I see two ways moving forward:
add the "type" on the element; this may require you to implement it on the test runner/framework that generates it. This will be a more straighforward approach; if you're using an open-source testing framework, you can try to support it or ask the open-source community of that project to provide support for it
or handle it on Xray side.. I would recommend you to reach Xray team and open a support ticket, as this may be an improvement that needs to be supported (it will need to be analyzed).
I'm using sonar for quite a long time and for me it is really great tool. Nowadays with plsql based project I have decided to use utplsql maven plugin to watch plsql tests results. Utplsql plugin outputs reports in junit like xml format. Unfortunately sonar is not presenting data from utplsql reports. This is plsql so there is no coverage or real java test classes - just an xml report. How to feed sonar just to view tests results, only main statistics like failed, success, all.
You might want to have a look at the Generic Test Coverage plugin. It will not be able to import directly xUnit type reports, but a bit of XSLT should allow you to convert to the correct format.
Is there a way to run JUnit programmatically in which I could pass custom PrintStream for all output of JUnit framework itself and leave standard output for test cases?
I see that JUnit internally is using JUnitSystem and TextListener to achieve this but I don't see intended entry point to use it without modifying or extending JUnitCore.
Does anyone have idea how to achieve this?
I don't think that JUnitCore and the classes used underneath print anything to standard out. The notable exception is JUnitCore.main, but this is just the main method for direct command-line execution. Instead you should use one of the run or runClasses methods. Your own RunListener can then output whatever/however it desires.
I want to add some hints to my build, to run certain tests "first" without re-running them later.
Simply add Class names to a "priority" string in an input parameter to my test task, or
Have JUnit's testers smart enough to remember/persist failing test class names, so that the next time around the builder runs those first.
What is the most idiomatic way of doing this in Ant?
The following tools might help you to achieve the desired JUnit test execution order, but they depend on Eclipse usage:
Continuous Testing for Eclipse (CT-Eclipse)
JUnit Max
infinitest
I have not used any of those tools, and I have no Ant-only solution.
You might consider these related posts:
Run JUnit automatically when building Eclipse project
Starting unit tests automatically after saving a file