Gradle plugin to provide junit-style XML report for custom tests defined within custom Gradle tasks
To use this plugin, the following buildscript repositories and dependencies must be configured:
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.github.warlordofmars:gradle-customtest-helper:release-0.1.11'
}
}
Then to apply the plugin:
apply plugin: 'com.github.warlordofmars.gradle.customtest'
To define tests:
ext.tests = [
someTestName: [
'<source file / class being tested>',
'Descriptive Name of the Test to include in final Report.'
]
]
Then in custom gradle task that is actually applying test logic, you can access an object representation of the test using the key value, someTestName
, defined in the tests
mapping above.
task('someCustomTest') {
dependsOn registerTests
doLast {
try {
// something that might fail
someTestName.success("Looks good!")
} catch(Exception e) {
someTestName.failure("Error!", "Exception was caught: ${e.toString()}")
}
}
}
Versioning on this project is applied automatically on all changes using the axion-release-plugin. Git tags are created for all released versions, and all available released versions can be viewed in the Releases section of this project.
- John Carter - warlordofmars
This project is licensed under the MIT License - see the LICENSE.md file for details
- Using the warlordofmars gradle plugin, gradle-release-helper, for automatic versioning, git tagging, and publishing of releases to GitHub
- Using the warlordofmars custom gradle distribution warlordofmars-gradle in order to define default repositories to avoid duplication across all projects
- Using the warlordofmars jenkins pipeline library jenkins-library for re-usable CI/CD pipeline components