forax / pro

A Java build tool that works seamlessly with modules
GNU General Public License v3.0
103 stars 15 forks source link

Project layout regarding (unit) testing #4

Closed sormuras closed 7 years ago

sormuras commented 7 years ago

While finding new ways and (initial) best practices on how to structure a modularized project I came up with this picture:

src/main
  module-a/
    "package a.api"
    "package a.impl"

src/test
  module-testing-a/
    "package a.tests"

  unit-testing-a/
    "package a.impl"

Why two test folders?

module-testing-a: is a module, that requires module-a and executes tests against the published API of module-a unit-testing-a: is a legacy-style, same-package overlay thing over module-a that is using the same package structure as module-a

Is this configurable with pro? Or am I on a complete false track regarding (unit) testing?

forax commented 7 years ago

if you rename unit-testing-a to module-a, it will work as you want.

the convention is that if a module in test has the same name as the module in main, the tests will be merged.

sormuras commented 7 years ago

Rename to src/test/module-a and ~no~ with module-info.java, right? Just copy it from the main module and add required test libraries?

forax commented 7 years ago

The module-info.java of src/main/module-a and the module-info.java of src/test/module-a are merged when creating the test module.

The idea is that the module-info of src should only contains the source dependencies while the module-info of test should contains the test specific dependencies

sormuras commented 7 years ago

Sometimes it's so easy to see ones' dreams come to existence.

pro should ship with in jdk-9!

sormuras commented 7 years ago

Created https://youtrack.jetbrains.com/issue/IDEA-172647 ... hoping IDEA will adopt this useful convention.