Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a folder layout convention for test sources files and test resources files? #160

Open
cheonhyangzhang opened this issue Dec 22, 2020 · 2 comments · May be fixed by #171
Open

Is there a folder layout convention for test sources files and test resources files? #160

cheonhyangzhang opened this issue Dec 22, 2020 · 2 comments · May be fixed by #171

Comments

@cheonhyangzhang
Copy link

cheonhyangzhang commented Dec 22, 2020

In https://gradle.github.io/playframework/#project_layout, it describes a /test folder to hold test files. But didn't mention about test sources files and test resources files.
Is there a convention for test resources files?
I see some play apps are having /test/ folder to contain test sources files and /test/resources to contain test resources files, I am wondering if this is a good approach and if it is following gradle play best practice convention.

In my understanding a normal approach is to have different dedicated folder for test sources files and test resources files, e.g. /test/java for test sources files and /test/resources/ for test resources files.

@Sineaggi
Copy link
Contributor

Sineaggi commented Jan 6, 2022

We came across this as well when migrating from sbt to gradle.

In sbt, test/resources is reserved for testing resources, however during migration we found that our test resources weren't being picked up while running tests. According to running

sourceSets.test {
    println(resources.srcDirs)
}

we see that by default the test resources directory is set to src/test/resources.

@Sineaggi Sineaggi linked a pull request Jan 6, 2022 that will close this issue
@mwxxhdb
Copy link

mwxxhdb commented May 26, 2022

sourceSets {
    test {
        resources {
            srcDirs= ["test/resources"]
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants