Issue
I am writing the unit test for the first time. In order to create the test file in IntelliJ, I created a *Test.java
by using shortcut [https://www.jetbrains.com/help/idea/create-tests.html]. Now when I am trying to run mvn test
it is not running any tests.
pom.xml
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
- Few answers from SO I found was to check the name. I checked and the name of the file is
<classNametoTest>Test.java
and I can also see the JUnit symbol on the file. - I have another folder named
test
(in root directory). In order to verify, I tried to rename the folder and didmvn clean package
->mvn test
. Not tests run. Test
folder is there insrc
as well [https://stackoverflow.com/questions/6178583/maven-does-not-find-junit-tests-to-run]
Solution
can you check if you have @Test
is imported from org.junit.jupiter.api.Test
Answered By - sanjeevRm
Answer Checked By - Robin (JavaFixing Admin)