Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support resultsDir per test task #50

Open
2 tasks
ghost opened this issue Jul 17, 2019 · 2 comments
Open
2 tasks

support resultsDir per test task #50

ghost opened this issue Jul 17, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 17, 2019

I'm submitting a ...

  • bug report
  • [ X] feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

we have a project that has multiple test sourceSets. The plugin currently uses one resultsDir per project. Thus the generated allure results files from multiple tasks end up in the same directory.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?

What is the motivation / use case for changing the behavior?

this does not play well together with the gradle build cache:
Gradle does not know how file 'build/allure-results/0c15ba66-f079-463a-a65c-cd606fb2995c-result.json' was created (output property '$1'). Task output caching requires exclusive access to output paths to guarantee correctness.

I think it would be helpful if the plugin would add the name of the sourceSet to the resultsDir.
this way results from different tasks would end up seperately. similiar to XML test reports generated by the test task.

Please tell us about your environment:

plugins {
      id("io.qameta.allure") version "2.8.1"
}

allure {
    autoconfigure = true
    version = "2.12.1"
    aspectjVersion = "1.9.4"

    useJUnit5 {
        version = "2.12.1"
    }
}

Other information

@ghost
Copy link
Author

ghost commented Jul 19, 2019

my current workaround:

val allureResultsRoot = "build/allure-results-dir"

project.gradle.taskGraph.whenReady {
    val ALLURE_DIR_PROPERTY = "allure.results.directory"

    tasks.withType(Test::class) {
        val reportDir = "$allureResultsRoot/${this.name}"
        systemProperty(ALLURE_DIR_PROPERTY, reportDir)
        outputs.dir(reportDir)
    }

    val allureResultDirs =
        tasks.withType(Test::class).map {
            File(allureResultsRoot, it.name)
        }

    tasks.withType(AllureReport::class) {
        resultsDirs = allureResultDirs
    }

    tasks.withType(AllureServe::class) {
        resultsDirs = allureResultDirs
    }
}

this reconfigures all test tasks to use separate output folders for the allure-results.

@vlsi
Copy link
Contributor

vlsi commented Apr 27, 2021

This PR adds per-task result and report directories: #61

Please feel free to try it and provide feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant