Where should test classes be stored in the project?

Posted by limc on Stack Overflow See other posts from Stack Overflow or by limc
Published on 2010-05-25T15:22:47Z Indexed on 2010/05/25 15:31 UTC
Read the original article Hit count: 201

I build all my web projects at work using RAD/Eclipse, and I'm interested to know where do you guys normally store your test's *.class files.

All my web projects have 2 source folders: "src" for source and "test" for testcases. The generated *.class files for both source folders are currently placed under WebContent/WEB-INF/classes folder.

I want to separate the test *.class files from the src *.class files for 2 reasons:-

  • There's no point to store them in WebContent/WEB-INF/classes and deploy them in production.
  • Sonar and some other static code analysis tools don't produce an accurate static code analysis because it takes account of my crappy yet correct testcase code.

So, right now, I have the following output folders:-

  • "src" source folder compiles to WebContent/WEB-INF/classes folder.
  • "test" source folder compiles to target/test-classes folder.

Now, I'm getting this warning from RAD:-

Broken single-root rule: A project may not contain more than one output folder.

So, it seems like Eclipse-based IDEs prefer one project = one output folder, yet it provides an option for me to set up a custom output folder for my additional source folder from the "build path" dialog, and then it barks at me.

I know I can just disable this warning myself, but I want to know how you guys handle this.

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse