Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
my tests are run by surefire plug-in. In case test failed I get the following output:
Results :
Failed tests:
test1(com.my.MyClassTest)
Tests run: 3, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
Please refer to /home/user/myproject/mymodule/target/surefire-reports for the individual test results.
To get the details about the problem I have to go and check surefire reports folder. Doing this every time my tests fail becomes annoying. Is there any way I can get those details (assert message + exception + stack trace) right here on the stdout ?
I find there's way too much output produced on stdout
to be useful. Try leaving the HTML report open in your browser. After running your tests just refresh the page. Have a look at target/surefire-reports/index.html
.
To output test results to stdout
rather than a file use the following command:
mvn test -Dsurefire.useFile=false
Or to configure in your pom.xml
add the following to your plugins
section.
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<useFile>false</useFile>
</configuration>
</plugin>
–
–
–
It's possible you may be using an older version of Surefire. I have found that newer versions produce more useful output on the console.
If you only want to see failing tests or tests with errors and only see errors in the build, you can pass the -q argument to your Maven build command.
please check your version of jacoco plugin is compatible with jdk or not:
i was getting similar issue , test cases were passing but it was failing while building project. so upgraded version worked for me:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.