Where should classes be tested in a project?

I built all my web projects at work using RAD / Eclipse, and I am interested to know where you usually store your test .class files.

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

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

  • It makes no sense to store them in WebContent / WEB-INF / classes and deploy them during production.
  • Sonar and some other static code analysis tools do not provide accurate static code analysis, because it takes into account my crappy but correct code to test.

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

  • The "src" source folder is compiled into the WebContent / WEB-INF / classes folder.
  • The "test" source folder is compiled into the target / test class folder.

Now I get this warning from RAD: -

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

So it seems that the Eclipse IDEs prefer one project = one output folder, but it gives me the ability to configure a custom output folder for my additional source folder from the build path dialog box, and then barks at me.

I know that I can simply turn off this warning, but I want to know how you deal with this.

Update

. RAD v7.5.5. , Maven. Maven, Maven - , , Websphere. , Mavenized Webpshere, .

alt text http://www.imagebanana.com/img/89q9o46t/s1.jpg

+3
3

TEST, SOURCE.

, , , , , .

+3

, com.example.MyClass. MyClassTest com.example, test:

        module
        /     \
      src   -> target <-
      /  \
   main   test
     |      |
    java   java
     |       |
     com    com
     |        |
    example  example
     |        | 
MyClass.java MyClassTest.java

Maven.

target.

+2
source

Source: https://habr.com/ru/post/1747042/


All Articles