Questions tagged [nebula-test]

Classes specific to testing a Gradle project, leveraging Spock

ProjectSpec

Uses Project Builder to create a in-memory expression of a Gradle build (project variable), specifically in a projectDir. A sanitized project name will be stored in canonicalName. Caveat, this is ONLY setting up the Project data structure, and not running through the completely lifecycle, Like to see http://issues.gradle.org/browse/GRADLE-1619.

Its value lays in being able to execute method with a proper Project object, which can flush out most groovy functions, finding basic compiler like issues. The private method evaluate() can be called on the project variable for force evaluation of afterEvaluate blocks, keeping in mind that still won't generate a task gradle or run the tasks.

PluginProjectSpec

Small abstraction over ProjectSpec for plugins, adds three tests that ensure the plugin can be applied properly (idempotently and in a multi-project).

IntegrationSpec

Orchestrate a Gradle build via GradleLauncher, which is deprecated, or the Tooling API to perform a high-level integration test of a project. Each test gets it's own test directory, called projectDir. It is up to the implementer to add contents to the buildFile and the settingsFile. The project's name is available as moduleName, which is a sanitized version of the test's name.

The spec will assume the Tooling API, but this can be changed by setting useToolingApi to false in which case the GradleLauncher will be used. It's risky to use since it's not support, but it provide more details from the resulting build. Though if you're checking the contents of the projectDir after build, it shouldn't matter. The GradleLauncher is required to debug the running of your build, you can't set break points in the build.gradle file, but you can set them in the plugins being called.

Generating Test Maven and Ivy Repos

Multi-project Helpers

MultiProjectHelper

MultiProjectHelper can create various sub-projects using the ProjectBuilder.

MultiProjectIntegrationHelper

MultiProjectIntegrationHelper can create sub-projects using our IntegrationSpec.

Full Documentation

7 questions
1
vote
1 answer

How to configure nebula.integtest with gradle project's integration tests ( kotlin DSL)?

I wanna separate integration from unit tests in my gradle kotlin dsl project build ( the project itself written on java). There are many answers here how to configure source set etc. But I came across nebula.integtest plugin ( I hope it's well known…
cpu
  • 65
  • 7
1
vote
1 answer

nebula-test fails to load the project plugin class when using IntegrationSpec class

I'm in the process of writing and testing a Gradle plugin. When I try to test the plugin I get an error indicating the plugin class can't be found? If I use the plugin id I get: Plugin with id <> not found. If I use the plugin class name I get:…
James Poli
  • 11
  • 1
1
vote
1 answer

Gradle complains about missing "setupMethod" with initial integration test structure

I'm writing my first Gradle plugin. The default build works fine, including a small number of unit tests. I'm now trying to set up an integration test infrastructure, using nebula.test. I created an empty integration test class, along with…
David M. Karr
  • 14,317
  • 20
  • 94
  • 199
0
votes
1 answer

nebula integration test with java

I am a java developer in my project, I want to have an integration test with nebula I want to know more about samples and best practices for Seed info in my DB with the Factory then Assert them. is there any nice package or module or library that…
saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58
0
votes
1 answer

nebula-test fails to find resources dir in classpath for copyResources

I'm writing integration tests for my first Gradle plugin using nebula-test. I'm now working on a test that requires copying one or more files from my "resources" into the temp project directory. The "copyResources()" call is failing because it says…
David M. Karr
  • 14,317
  • 20
  • 94
  • 199
0
votes
1 answer

Custom Gradle task running under nebula-test fails to see created directory

I have a working build of a custom Gradle plugin. I have a couple of unit tests, and now I'm trying to get integration tests going, using nebula-test. I'm getting a confusing test error in the integration test. I must be doing something wrong in…
David M. Karr
  • 14,317
  • 20
  • 94
  • 199
0
votes
0 answers

Gradle nebula.test fails to download Gradle distribution

I'm writing my first Gradle plugin. It's functionally working pretty well, and I have a couple of unit tests working. I'm now starting to set up integration tests using nebula.test. After resolving a simple Spock version number mismatch problem…
David M. Karr
  • 14,317
  • 20
  • 94
  • 199