I have a module A which includes other module B at compilation. This has been done by adding the following line in module A.
compile project(':B')
Module A and B have their specific set of test classes.
While running gradle test from module A, I don't want certain test classes of Module B to get executed.
While I can add a excludes block in gradle test task of module B, I want to do this from module A to have full control on the test execution from module A.
I have already tried the following code in module A.
test {
excludes = [
"B/src/test/**"
]
}
But this doesn't seem to be working.
May I know what I am doing wrong?
Module A and B are located in the same folder.
When you issue gradle test, gradle will run the task named ‘test’ in every sub-project. If you only want to test A’s classes, you can issue gradle A:test instead. This might already solve your problem.
If you really want to run certain tests while testing A you can define a new task in B that you will call as part of A’s test task.
// place in project B
tasks.register('myCustomTest', Test) {
// exclude the classes you want
}
// place in project A
test.dependsOn ‘B:myCustomTest'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With