-1

I have inherited a project which has over 100 Junit test classes. The problem is the unit test sources and main source files are in the same folder.There is no src/test/java folder.This can be built with ant, but with maven I am not able to get maven run the tests unless I refactor every test in to src/test folder. Is there a way to specify the a directory other than src/test/java from where mvn can run the tests?

1 Answers1

1

Move the tests into src/test. If you've inherited the project then it's time to fix mistakes.

From src/test, generate a list of test classes. If there's a naming convention:

find . -name 'Test*.java' -or -name '*Test.java' >../test-classes

If they're all using JUnit:

fgrep -lR 'junit.' >../test-classes

Then move those files into src/test by scripting your scm.

Joe
  • 29,416
  • 12
  • 68
  • 88