How to write an integration test for the Gradle plugin

I am writing a plugin for Gradle . This is the port of the Maven plugin that I am testing with the Maven Integration Integration Plugin. I would like to create a series of tests for different files build.gradle.

Is there a good way to do this is Gradle (because what seems to be not working for me).

+4
source share
2 answers

Yes, the easiest way to do a simple test is to use the org.gradle.testfixtures.ProjectBuilder class.

Project project = ProjectBuilder.builder().build()
project.apply plugin: 'dependencyAnalysis'
project.apply plugin: 'java'

assertTrue(project.tasks.analyze instanceof AnalyzeTask)

However, this can only be checked before the configuration phase. Therefore, to check the execution phase, this will not work.

API- , , Opal, , . https://github.com/nebula-plugins/nebula-test

+5

Gradle TestKit Gradle, . , , . -, .

+1

All Articles