Comments (18)
Because it used to be in earlier versions - we used it to set up a custom folder for the results of the run.
from allure-gradle.
In this case - @rickflar if you need to use a working plugin with task customization, I mean - override default report outputs, disabling SPI OFF (), task aggregation - just not use the latest versions for Allure. Unfotunantliy you lose support for gradle 7 - because the last plugin changes/fixes not working in multiple places, not support manual customizations.
Currently, all work as expected with old versions of allure gradle plugin 2.8.1, gradle 6.9.1:
id("io.qameta.allure") version "2.8.1"
tasks.withType<Wrapper> {
gradleVersion = "6.9.1"
distributionType = Wrapper.DistributionType.ALL
}
@vlsi in my case (and many allure users) - we did not use autoconfiguration {} closure at all - we use allure extensions just to have proper API binding from gradle to allure command-line. Like this:
configure<AllureExtension> {
version = `allure-version`
autoconfigure = false
aspectjweaver = false
configuration = "testImplementation"
reportDir = file(dynamic["allure.results.directory"].toStringOrEmpty())
}
val aggregatedReport by tasks.creating(AllureReport::class) {
group = "e2e-allure"
clean = true
reportDir = file("${rootProject.buildDir}/allure-report")
resultsDirs = subprojects.map {
file("${it.buildDir}/allure-results")
file("${it.projectDir}/allure-results")
}.filter { it.exists() }
resultsDirs.add(file("${rootProject.buildDir}/allure-results"))
}
tasks.withType<io.qameta.allure.gradle.task.AllureServe> {
group = "e2e-allure"
dependsOn("downloadAllure")
}
tasks.withType<io.qameta.allure.gradle.task.DownloadAllure> {
group = "e2e-allure"
}
tasks.withType<AllureReport> {
if (this.name == "allureReport") {
this.enabled = false
group = "deprecated"
}
}
from allure-gradle.
The folder is not documented, so it can be changed.
from allure-gradle.
@vlsi can we provide a possibility to override output per task?
from allure-gradle.
Ended up using somewat hacky solution. It works with gradle 8.5, java 21, allure 2.25.0
- Add file
src/test/resources/allure.properties.bak
with text:
allure.results.directory=RESULT_DIR
- In
build.gradle
add task and configure task dependency:
task allureProperties(type: Copy) {
outputs.upToDateWhen{ false }
from file('src/test/resources/allure.properties.bak')
into 'src/test/resources/'
rename{ 'allure.properties' }
filter{ line -> line.replace('RESULT_DIR', file(layout.buildDirectory.dir('allure-results')).toString()) }
}
processTestResources{
dependsOn(tasks.allureProperties)
}
This task will copy content of bakup properties file to actual file and replace results directory value with absolute path.
If you don't care about other properties and need to set only result path, you can omit bakup file and simplify tasks to:
task allureProperties {
outputs.upToDateWhen{ false }
doFirst {
def props = file('src/test/resources/allure.properties')
props.write("allure.results.directory=${file(layout.buildDirectory.dir('allure-results'))}")
}
}
processTestResources{
dependsOn(tasks.allureProperties)
}
from allure-gradle.
Ended up using somewat hacky solution. It works with gradle 8.5, java 21, allure 2.25.0
If you don't care about other properties and need to set only result path, you can omit bakup file and simplify tasks to:task allureProperties { outputs.upToDateWhen{ false } doFirst { def props = file('src/test/resources/allure.properties') props.write("allure.results.directory=${file(layout.buildDirectory.dir('allure-results'))}") } } processTestResources{ dependsOn(tasks.allureProperties) }
thanks a lot, hacky but does the trick!! kudos for coming up with that :D
from allure-gradle.
Why do you need it?
from allure-gradle.
The thing is there might be mulitple tasks (e.g. test
, integrationTest
, javaexec
, etc) that collect Allure raw results.
That makes "single result folder" complicated.
from allure-gradle.
For instance, https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:task_input_output_parallelism
Gradle will inspect the outputs of tasks when selecting the next task to run and will avoid concurrent execution of tasks that write to the same output directory
from allure-gradle.
I would like to see an end-to-end use-case
from allure-gradle.
As i noticed, results appear in allure-results folder in build folder by default. So, it's the case of "single result folder", isn't it? Or without setting a resultsDir variable, results can appear in different folders?
For instance, https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:task_input_output_parallelism
Gradle will inspect the outputs of tasks when selecting the next task to run and will avoid concurrent execution of tasks that write to the same output directory
from allure-gradle.
@baev maybe you had the same case as mine in the previous comment? Can you help and advise us here? ... how we can create a correct working example with the latest gradle API + not-broken plugin. theoretically, I can just make direct calls to bat files...
from allure-gradle.
Does there are any solutions? We have this problem, I running test case in different environments but I wanna keep different results in different folder. such as if I specify -Denv=qa
and results will place at build/projectName/qa/allure-results
and I specify -Denv=prod
and results will place at build/projectName/prod/allure-results
. and the same as report. Any solutions can help?
from allure-gradle.
Has anyone found a solution to this problem? We're facing the same issue here...
from allure-gradle.
@Leo-Lem , would you please clarify what is your issue exactly?
What is your use case, and why do you need to customize the folder?
from allure-gradle.
Hey @vlsi, we are updating a mobile test automation framework with appium, gradle, testng, allure etc. Due to parallel test execution, we'd like to have separate "build" directories for each gradle build to avoid conflicts (in the format of 'out-timestamp' under a results directory). This works well enough (by specifying the project's buildDir in the build.gradle file), only the allure-results are always generated in root/build/allure-results.
We'd appreciate it if a custom allure results directory could be configured...
from allure-gradle.
In my case allure just fails to produce raw results with error: io.qameta.allure.AllureResultsWriteException: Could not write Allure test result container caused by FileNotFoundException.
Tried to setup results dir in allure.properties but error remains the same.
While debugging allure code i noticed that this.mapper.writeValue(file.toFile(), testResultContainer);
fails if called in eval window as-is, but if a call it with file, resolved to absolute path: this.mapper.writeValue(new File(file.toAbsolutePath().toString), testResultContainer);
it works just fine.
If I change path to directory in allure.properties
to absolute path it works too.
from allure-gradle.
Any update on this? thanks!
from allure-gradle.
Related Issues (20)
- allureServe/allureReport task failing after the second run if category.json is saved under test/resources
- Allure result json doesn't contain any indication of group annotation when running a test which is executed as gradle task
- Invalid output property causes Gradle build cache miss
- Add support for Spock2 HOT 4
- Last version of Allure plugin (gradle) does not work properly HOT 4
- Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. HOT 1
- Add option to generate a single-file report via Gradle task
- Configuration cache: Cannot set the value of a property of type [...].Configuration using a provider of type [...].DefaultFileCollectionFactory$ResolvingFileCollection
- Allure gradle plugin causes execution of additonal test sets as part of build task HOT 3
- spi-off transformer should be disabled in case autoconfigure=false
- Able use custom java sdk HOT 2
- No reports are generated when using latest Allure version (2.16.1) HOT 3
- Allure commandline is downloaded into `build/allure` folder, but previously it was donwloaded into `.allure` folder in the project root HOT 1
- Issue integrating allure-plugin into build-conventions HOT 1
- Allure does not work together with reckon plugin HOT 2
- Aspectj dumps ajcore.txt files when applying allure-gradle plugin in project with spring-boot HOT 12
- Allure reports not generating after upgrading allure version from 2.8.1 to 2.9.4 HOT 2
- Example for report aggregation? HOT 1
- ClassCastException with Gradle 7.5-milestone-1 HOT 11
- Ignoring Aspectj version in allureAspectjWeaverAgent and allure extension without explicit implementation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from allure-gradle.