HI! I'd like to try another file layout for unit t...
# community-support
p
HI! I'd like to try another file layout for unit tests in my Gradle (Kotlin) project. Namely, instead of having a source file under
src/main/com/foo/MyModule.kt
and tests for it under
src/test/com/foo/MyModuleTest.kt
, I'd like something like
src/com/foo/MyModule.kt
and
src/com/foo/MyModuleTest.kt
, both in the same dir. Why: I got inspired by file layout I briefly worked with in a React/JS project a while back, and I wanted to see if Gradle and its concept of source sets is flexible enough to implement it 🙂 I liked it because one could immediately see which files got corresponding tests. In IDE, jumping between code and tests is easy so it's not a matter of problems with navigation.
p
It should be possible by setting the srcDir of the sourceSets and also exclude the tests using a pattern.