-1

I have junit and spring-test dependencies in my pom file. When i run the test goal of maven using eclipse it does not identify my test class.

maven-surefire-plugin:2.17:test (default-test) @ media-project ---
[INFO] No tests to run.

I have the test class start with Test and also methods start with test.

Harshana
  • 7,297
  • 25
  • 99
  • 173
  • By default, tests location must be `src/test/java`. can you show your pom.xml? – Héctor Aug 19 '15 at 08:30
  • Also By default, test class names must inform of "**/Test*.java", "**/*Test.java" or "**/*TestCase.java" according to [surefire-plugin documentation](http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html). – bhdrkn Aug 19 '15 at 08:32
  • Sow your pom the path where your test clases are located and a sample test class to see if you write Junit3 or 4 tests. – mszalbach Aug 19 '15 at 08:32
  • 1
    possible duplicate of [Maven does not find JUnit tests to run](http://stackoverflow.com/questions/6178583/maven-does-not-find-junit-tests-to-run) – Stefan Aug 19 '15 at 08:41

1 Answers1

2

You should follow the test conventions: Put you tests in the src/test/java location as opposed to the src/main/java where you put your normal code. Also the filenames have to match

"**/Test*.java"
"**/*Test.java"
"**/*TestCase.java"

See here

hfhc2
  • 4,182
  • 2
  • 27
  • 56