/gradle-customtest-helper

Gradle plugin to provide junit-style XML report for custom tests defined within custom Gradle tasks

Primary LanguageGroovyMIT LicenseMIT

gradle-customtest-helper

latest jitpack release

Overview

Gradle plugin to provide junit-style XML report for custom tests defined within custom Gradle tasks

Setup

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

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.

Author

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgements