Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softeq/itest-gradle-plugin
Integration testing plugin for the Gradle. It allow in simple way to add and execute integration tests in the Java project
https://github.com/softeq/itest-gradle-plugin
gradle gradle-plugin gradle-plugin-test groovy integration-testing junit5 testng
Last synced: 26 days ago
JSON representation
Integration testing plugin for the Gradle. It allow in simple way to add and execute integration tests in the Java project
- Host: GitHub
- URL: https://github.com/softeq/itest-gradle-plugin
- Owner: Softeq
- License: mit
- Created: 2019-10-25T09:32:41.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-31T16:23:10.000Z (over 3 years ago)
- Last Synced: 2024-11-15T02:34:40.725Z (about 1 month ago)
- Topics: gradle, gradle-plugin, gradle-plugin-test, groovy, integration-testing, junit5, testng
- Language: Groovy
- Homepage: https://softeq.github.io/itest-gradle-plugin/
- Size: 152 KB
- Stars: 18
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Gradle Integration Testing Plugin
[![Build Status](https://travis-ci.org/Softeq/itest-gradle-plugin.svg?branch=master)](https://travis-ci.org/Softeq/itest-gradle-plugin)
[![Coverage Status](https://coveralls.io/repos/github/Softeq/itest-gradle-plugin/badge.svg?branch=master)](https://coveralls.io/github/Softeq/itest-gradle-plugin?branch=master)
[![Gradle Plugin](https://img.shields.io/maven-metadata/v.svg?label=gradle&metadataUrl=https://plugins.gradle.org/m2/com/softeq/gradle/itest/com.softeq.gradle.itest.gradle.plugin/maven-metadata.xml)](https://plugins.gradle.org/plugin/com.softeq.gradle.itest)There are plugin that allow to configure integration tests same way as unit tests in simple way
## Build
To build the project it is require to execute
```bash
./gradlew clean build
```## Documentation
Content:
1. [Quick Start](#quick-start)
2. [Source Set](#source-set)
3. [Integration Test Task](#integration-test-task)
- [JUnit 5](#junit-5)
- [TestNG](#testng)
- [Spock](#spock)
4. [Dependencies Management](#dependencies-management)
5. [Skip Tests](#skip-tests)
6. [Configurable Parameters](#configurable-parameters)### Quick Start
To add ***itest*** plugin to your project it will require to add next code to the `build.gradle`
```groovy
plugins {
id 'com.softeq.gradle.itest' version '1.0.4'
}
```Or with Kotlin
```kotlin
plugins {
id("com.softeq.gradle.itest") version "1.0.4"
}
```After that you will have possibilities to write tests to the **itest/** folder.
To run the tests you just need to execute in your project
```bash
./gradlew clean build
```### Source Set
There are by default application add new source set to the project with name `itest`.
To change name of the source set it is possible to use `name` configuration parameter. In this case location of
integration test sources will be at folder with specified name.With Groovy / Kotlin
```groovy
itestSourceSet {
name = "integrationTest"
}
```Also there are possible to customize compile classpath and runtime classpath of the source set
Groovy
```groovy
itestSourceSet {
name = "integrationTest"
compileClasspath = sourceSets.main.compileClasspath
runtimeClasspath = sourceSets.main.runtimeClasspath
}
```Kotlin
```kotlin
itestSourceSet {
name = "integrationTest"
compileClasspath = sourceSets["main"].compileClasspath
runtimeClasspath = sourceSets["main"].runtimeClasspath
}
```### Integration Test Task
Current plugin also configure task `integrationTest` that extends standard `Test` task of the Gradle.
Configuration parameters for this task you may find
[there](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html)#### JUnit 5
To add support of JUnit 5 you will require to specify at configuration taskGroovy
```groovy
integrationTest {
useJUnitPlatform()
}
```Kotlin
```kotlin
tasks.withType {
useJUnitPlatform()
}
```#### TestNG
To use TestNG for integration testing of you application it will require to specify next configuration for the
`integrationTest` taskGroovy
```groovy
integrationTest {
useTestNG()
}
```Kotlin
```kotlin
tasks.withType {
useTestNG()
}
```#### Spock
To use Spock framework with the plugin it will require just to add the Spock dependencies
Groovy / Kotlin
```kotlin
dependencies {
itestImplementation("org.spockframework:spock-core:1.3-groovy-2.5")
}
```### Dependencies Management
There are possible to specify additional dependencies for the integration test classes
| Standard Configuration| itest Configuration | Description |
|-----------------------|----------------------|-----------------------------------|
| implementation | itestImplementation | Implementation dependencies scope |
| compileOnly | itestCompileOnly | Compile Only dependencies scope |
| runtimeOnly | itestRuntimeOnly | Runtime Only dependencies scope |You can specify this dependencies in the `dependencies` section of the `build.gradle` file
Groovy
```groovy
dependencies {
itestRuntimeOnly 'com.h2database:h2:1.0.60'
}
```Kotlin
```kotlin
dependencies {
itestRuntimeOnly("com.h2database:h2:1.0.60")
}
```### Skip Tests
To skip integration tests you need to provide `-PdisableIntegrationTests` option to the gradle.
For instance
```bash
gradlew clean build -PdisableIntegrationTests
```Alternative options to disable integration and unit tests you can find below
```bash
gradlew clean build -x test -x integrationTest
```### Configurable Parameters
There are table with available plugin configuration parameters
| Param | Parent Configuration | Default Value | Description |
|------------------|----------------------|---------------|-----------------------------------|
| name | itestSourceSet | "itest" | There are name of the folder with integration test sources |
| compileClasspath | itestSourceSet | Main SourceSet output and classpath | There are classpath of the compiler to build integration tests |
| runtimeClasspath | itestSourceSet | Main SourceSet output and runtime classpath | There are runtime classpath that will be used during integration tests evaluation |
| [Gradle Test Params](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html) | integrationTest | - | There are standard Gradle Test task configuration |
| useJUnitPlatform() | integrationTest | - | There are option to enable JUnit 5 tests execution |
| useTestNG() | integrationTest | - | There are option to enable TestNG evaluation support |## License
MIT