📃
tech-diary
  • Overview
  • Kubernetes & OCP
    • Useful Scripts
    • FAQs
  • Docker
    • FAQs
  • Java Development
    • Spring Boot 2 Tips & FAQ
    • Maven Tips & FAQ
    • JDKs and IDEs Tips & FAQ
    • Unit Test Tips & FAQ
  • Go Development
    • Cobra Walkthrough Guide
    • Go Template Walkthrough Guide
    • Logging in Golang
    • Code Walkthrough for Identified OSS Projects
  • Operating Systems
    • RHEL
    • Ubuntu
    • Centos
  • DevOps
    • Git & GitHub Tips
  • Communities
  • RDBMS
    • Contribution Record
    • MySQL
  • Tools
    • VS Code
Powered by GitBook
On this page

Was this helpful?

  1. Java Development

Unit Test Tips & FAQ

mvn test doesn't run the tests

If you run mvn test but it tells you that:

$ mvn test
...
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

There might be a couple of reasons, like incidentally using JUnit 5 but you're using JUnit 4's mechanisms.

In my case, it was caused by excluding org.junit.vintage:junit-vintage-engine in org.springframework.boot:spring-boot-starter-test dependency.

So I have to make sure not excluding it. For example:

		<!-- testing related dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>junit</groupId>
		    <artifactId>junit</artifactId>
		    <scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.rest-assured</groupId>
			<artifactId>rest-assured</artifactId>
			<scope>test</scope>
		</dependency>
PreviousJDKs and IDEs Tips & FAQNextCobra Walkthrough Guide

Last updated 5 years ago

Was this helpful?