Correct location (in Gradle) to put code that should be run in _all_ test cases?
Question
Just wondering... I have some code (disabling certain logging output) that I'd like to be run before all tests...
I do not see any such examples for JUnit/Groovy testing in the samples directory... is there a good/correct place to put such code?
Thank you!
Misha
p.s. I am using the 0.9 preview 3 version.
Solution
According to the Test source code, you should be able to set a beforeSuite/beforeTest Closure on the test Task. I haven't tried it, but I imagine it works something like this:
test {
beforeSuite{
//run custom setup code here
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow