I'm trying to figure out how to customize the test case XML generated by Gradle. The goal is to add custom keys to the test cases so they can be identified in the modified testcase XML.
To do this, we need to:
However, the annotated tags under the tag are not being updated.
Has anyone successfully implemented this in an Android project? Thanks in advance!
Please have a look at this Gradle+Junit5 enhanced tutorial and corresponding code.
You need to:
...
test {
useJUnitPlatform()
reports {
// destination = file('build/test-results/folder')
junitXml.required = true
html.required = false
}
ignoreFailures = true
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testImplementation 'app.getxray:xray-junit-extensions:0.6.1'
}
...
@Requirement
and/or @XrayTest
where appropriate (example) @Test
@XrayTest(key = "CALC-739")
@Requirement("CALC-740")
public void CanAddNumbers()
{
assertThat(Calculator.add(1, 1), is(2));
assertThat(Calculator.add(-1, 1), is(2));
}