I have multiple classes under tests using junit and gradle. When I run "gradle test", all my classes are tested. How can I run just one test file?
Asked
Active
Viewed 7,444 times
2 Answers
13
You can run a single test file from the cli like this:
gradle test --tests org.gradle.SomeTest
You can also run just a particular test method in a similar way:
gradle test --tests org.gradle.SomeTest.someSpecificFeature

OlgaMaciaszek
- 3,662
- 1
- 28
- 32
-
Just learned this today, and I think it's terrible. Who has time to accurately type all that crap? I'm used to being able to click a single button in Netbeans and *it just works*... – User Nov 16 '16 at 05:51
-
If you are using some ide, for example IDEA, it can usually handle gradle pretty well, so you can run the test from IDE with one click in place of the gradle commands. Unless you are debugging some gradle-related issues which appear in the test, that is usually just fine. – OlgaMaciaszek Nov 22 '16 at 16:17