On 8/02/10 7:00 PM, Peter Ledbrook wrote:
Hi,

The subject pretty much says it all. I notice that Gradle has its own
integration test framework with executors - are these available to
plugins for their own integration tests?

Not really. But they could be, with some tidy-up.

For Gradle, we have 2 types of tests for plugins:

1. The test uses a fixture to create a Project instance, which the test drives programmatically eg

@Test pluginDoesSomeStuff() {
    Project project = createRootProject()
    project.apply type: MyCustomPlugin

    // Make some assertions about what the plugin has done to the project
}

2. The test uses a fixture to execute a Gradle build. There are 2 implementations: one uses the GradleLauncher API to run the build in process, and one forks the gradle command to run the build in a child process. E.g:

@Test pluginDoesSomeStuff() {
    File buildFile = ...
    buildFile << '''
    apply type: MyCustomPlugin
    // maybe some other stuff
'''

    executer.usingBuildFile(buildFile).withTasks('someTask').run()

    // make some assertions about what the build has done
}


Is this the sort of thing you had in mind?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to