Currently I build my Gradle app by running gradle clean build
. This exercises JUnit tests and produces XML test results in my project under build/test-results
. I would like to configure my build.gradle
file to produce HTML test results (instead of the XML default). Is this possible, if so, how?
Asked
Active
Viewed 3.8k times
38
![](../../users/profiles/4009451.webp)
smeeb
- 22,487
- 41
- 197
- 389
1 Answers
63
test {
reports {
junitXml.enabled = false
html.enabled = true
}
}
To figure this out on your own, start from Test
in the Gradle Build Language Reference, then drill down into (the type for) reports
.
![](../../users/profiles/84889.webp)
Peter Niederwieser
- 111,903
- 17
- 295
- 240
-
5Thanks @Peter Niederwieser (+1) - I think you are referring to [this link](http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:reports) which I had already found prior to posting my question. **The root problem is this: that link doesn't mention the `junitXml.enabled` or `html.enabled` properties at all...so how in the world is anybody supposed to know they exist?!?** – smeeb Sep 21 '14 at 21:44
-
2Click the next link (`TestTaskReports`). What's missing in my answer that caused you not to accept it? – Peter Niederwieser Sep 21 '14 at 22:05
-
2Thanks again @Peter Niederwieser (+1) - I guess I'm just stunned that this isn't documented anywhere else besides API docs, which one then has to *manually infer* property names from (using Camel Casing). – smeeb Sep 21 '14 at 23:14
-
Usually these things are documented in the DSL reference, but sometimes they aren't. – Peter Niederwieser Sep 22 '14 at 01:11
-
13Anyone knows how this would be for android gradle scripts ? – slott Apr 20 '16 at 14:17
-
5This doesn't seem to have any effect under JUnit 5, even for JUnit 4-based tests. – David Moles Oct 17 '17 at 23:50
-
3where do I place this? – Pedro Rodrigues Nov 04 '18 at 02:13