Correct location (in Gradle) to put code that should be run in _all_ test cases?

StackOverflow https://stackoverflow.com/questions/3011571

  •  26-09-2019
  •  | 
  •  

문제

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.

도움이 되었습니까?

해결책

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
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top