Reputation: 7851
My tests are compiled and "run", but my test method isn't executed. Maven prints:
T E S T S
-------------------------------------------------------
Running spring.test.Aufgabe0.TestMinimalTestCase
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@4b
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.408 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
My test class is really small and should fail:
package spring.test.Aufgabe0;
import org.junit.Test;
import static org.junit.Assert.*;
public class TestMinimalTestCase {
@Test
public void testMinimalTest() {
int i = 3;
assertTrue(i == 2);
}
}
I imported JUnit and configured the test path as you can see:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
...
<build>
<sourceDirectory>src/java</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
The test suite runs in Eclipse, but I can't figure out why it's not working with maven.
Import testng Test. This shouldn't make a difference: "Tests in your test source directory can be any combination of the following: TestNG JUnit (3.8 or 4.x)..." Surefire documentation
How do I run junit tests with testng in my scope / dependecy list?
Upvotes: 0
Views: 1042
Reputation: 41985
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@4b
Looking at this I suppose you are using TestNG while Maven build, but you have import of org.junit.Test
.
Use @Test
from TestNG.
Upvotes: 1