# Can I create html reports per test task?

**URL:** <https://discuss.gradle.org/t/can-i-create-html-reports-per-test-task/1604>\
**Category:** Old Forum Archive\
**Created:** [March 13, 2015, 1:06pm UTC](https://discuss.gradle.org/t/can-i-create-html-reports-per-test-task/1604 "2015-03-13T13:06:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus\_Oley](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@Markus\_Oley](https://discuss.gradle.org/u/Markus_Oley)\
**Post date:** [March 13, 2015, 1:06pm UTC](https://discuss.gradle.org/t/can-i-create-html-reports-per-test-task/1604/1 "2015-03-13T13:06:00Z")

</div>

Hi,

I have a project with different tes tasks. They maybe contain same testclasses which run against different environments. Can I create the html report per test task?

I have tried:

project.tasks.withType(Test).each {

Test test-\> test.reports.html.destination = file(“build/myreports/”+ [test.name](http://test.name)) }

but that doesn’t work

Do I have an error in my Buildfile or have I found a bug?

Cheers Markus

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [March 13, 2015, 1:18pm UTC](https://discuss.gradle.org/t/can-i-create-html-reports-per-test-task/1604/2 "2015-03-13T13:18:00Z")

</div>

can you try

```gradle
project.tasks.withType(Test) {Test test ->
    test.reports.html.destination = file("build/myreports/"+ test.name)
}

```

in this snippet we got rid of the “.each”. this means the configuration is applied lazy, also for tasks declared later in your build  
  
does that work for you?

---

<div class="post-metadata">

**Author:** ![Markus\_Oley](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@Markus\_Oley](https://discuss.gradle.org/u/Markus_Oley)\
**Post date:** [March 14, 2015, 8:21am UTC](https://discuss.gradle.org/t/can-i-create-html-reports-per-test-task/1604/3 "2015-03-14T08:21:00Z")

</div>

Hi Rene,

thanks for your answer. That doesn’t make a difference, sorry. Do you have any other suggestion for me? I am using gradle 2.2.1.

Cheers Markus
