Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
radarsh committed Nov 20, 2018
2 parents a491b94 + 107a10b commit 450dc74
Show file tree
Hide file tree
Showing 37 changed files with 501 additions and 100 deletions.
17 changes: 11 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
JVM_OPTS: -Xmx4096m
TERM: dumb
steps:
- checkout
Expand All @@ -23,17 +23,22 @@ jobs:
key: v1-dependencies-{{ checksum "build.gradle" }}
- run:
name: Run tests
command: GRADLE_OPTS="-Xms256m -Xmx1024m" ./gradlew clean test --no-daemon
command: GRADLE_OPTS="-Xms256m -Xmx2048m" ./gradlew build --no-daemon
- run:
name: Code coverage
command: GRADLE_OPTS="-Xms256m -Xmx1024m" ./gradlew jacocoTestReport coveralls --no-daemon
- run:
name: Save reports
command: |
mkdir -p ~/results
mkdir -p ~/reports
find . -type f -regex "./build/test-results/.*xml" -exec cp {} ~/results \;
cp -r build/reports/tests/test/* ~/reports
mkdir -p ~/results/unit
mkdir -p ~/reports/unit
find . -type f -regex "./build/test-results/test/.*xml" -exec cp {} ~/results/unit \;
cp -r build/reports/tests/test/* ~/reports/unit
mkdir -p ~/results/functional
mkdir -p ~/reports/functional
find . -type f -regex "./build/test-results/functionalTest/.*xml" -exec cp {} ~/results/functional \;
cp -r build/reports/tests/functionalTest/* ~/reports/functional
when: always
- store_test_results:
path: ~/results
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# Change Log

## [v1.5.0](https://github.com/radarsh/gradle-test-logger-plugin/tree/v1.5.0) (2018-09-09)
## [v1.6.0](https://github.com/radarsh/gradle-test-logger-plugin/tree/v1.6.0) (2018-11-20)

[Full Changelog](https://github.com/radarsh/gradle-test-logger-plugin/compare/v1.5.0...v1.6.0)

**Implemented enhancements:**

- Allow testlogger to be configured independently for each task [\#90](https://github.com/radarsh/gradle-test-logger-plugin/issues/90)

**Closed issues:**

- Test time reporting under the threshold [\#101](https://github.com/radarsh/gradle-test-logger-plugin/issues/101)
- Doesn't render tickmarks for mocha theme on Windows [\#99](https://github.com/radarsh/gradle-test-logger-plugin/issues/99)
- Add CompileStatic to more classes [\#97](https://github.com/radarsh/gradle-test-logger-plugin/issues/97)
- Print list of tests before execution [\#91](https://github.com/radarsh/gradle-test-logger-plugin/issues/91)
- JUnit5 Gradle Plugin interferes with this one [\#87](https://github.com/radarsh/gradle-test-logger-plugin/issues/87)
- Use of testLogger.showStandardStreams can lead to confusion [\#86](https://github.com/radarsh/gradle-test-logger-plugin/issues/86)

**Merged pull requests:**

- Add @CompileStatic to all classes [\#98](https://github.com/radarsh/gradle-test-logger-plugin/pull/98) ([radarsh](https://github.com/radarsh))
- Highlight lowercase extension name in documentation [\#96](https://github.com/radarsh/gradle-test-logger-plugin/pull/96) ([radarsh](https://github.com/radarsh))
- Clarify documentation about junit-platform Gradle plugin [\#95](https://github.com/radarsh/gradle-test-logger-plugin/pull/95) ([radarsh](https://github.com/radarsh))
- React to testLogging.showStandardStreams [\#94](https://github.com/radarsh/gradle-test-logger-plugin/pull/94) ([radarsh](https://github.com/radarsh))
- Configure testlogger for each task [\#93](https://github.com/radarsh/gradle-test-logger-plugin/pull/93) ([radarsh](https://github.com/radarsh))

## [v1.5.0](https://github.com/radarsh/gradle-test-logger-plugin/tree/v1.5.0) (2018-09-08)
[Full Changelog](https://github.com/radarsh/gradle-test-logger-plugin/compare/v1.4.0...v1.5.0)

**Implemented enhancements:**
Expand Down
85 changes: 71 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Scroll down for more themes and customisation options or visit the [screenshots

```groovy
plugins {
id 'com.adarshr.test-logger' version '1.5.0'
id 'com.adarshr.test-logger' version '1.6.0'
}
```

Expand All @@ -39,7 +39,7 @@ buildscript {
}
}
dependencies {
classpath 'com.adarshr:gradle-test-logger-plugin:1.5.0'
classpath 'com.adarshr:gradle-test-logger-plugin:1.6.0'
}
}
Expand All @@ -48,20 +48,59 @@ apply plugin: 'com.adarshr.test-logger'

## Configuration

All the below configuration settings can either be specified in `build.gradle` file or be set at runtime using system
properties or both. For instance, we could have `theme` set to `mocha` in `build.gradle` file but it can be overridden
to be `standard` at runtime by using `-Dtestlogger.theme=standard` on the command line. Since they're system properties
we have a number of ways of specifying them including `JAVA_OPTS` and `gradle.properties`.
The plugin registers an extension called `testlogger` (all lowercase and one word) at project level
as well as for each task of type [`Test`](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html).

The convention used for determining the name of the system property is `testlogger.<configuration setting>`.
The following shows the complete default configuration applied when you configure nothing.

- [Switch themes](#switch-themes)
- [Hide exceptions](#hide-exceptions)
- [Define slow threshold](#define-slow-threshold)
- [Hide summary](#hide-summary)
- [Show standard streams](#show-standard-streams)
- [Filter standard streams](#filter-standard-streams)
- [Filter test results](#filter-test-results)
```groovy
testlogger {
theme 'standard'
showExceptions true
slowThreshold 2000
showSummary true
showPassed true
showSkipped true
showFailed true
showStandardStreams false
showPassedStandardStreams true
showSkippedStandardStreams true
showFailedStandardStreams true
}
```

### Project vs task level configuration

Settings configured at the project level can be overridden by redefining them at task level. Settings
not defined at task level will inherit project level values. Consider the below configuration.

```groovy
testlogger {
theme 'mocha' // project level
slowThreshold 5000
}
test {
testlogger {
theme 'standard-parallel' // task level
}
}
```

In the above example, the effective theme will be `standard-parallel` and `slowThreshold` will be `5000` whereas rest of
the settings will retain their default values.

### Overriding settings at runtime

All the above settings can either be specified in `build.gradle` or be set at runtime using system properties or both.
For instance, we could have `theme` set to `mocha` in the build file but it can be overridden to be `standard` at runtime
by using `-Dtestlogger.theme=standard` on the command line. Since they are system properties we have a number of ways of
specifying them including `JAVA_OPTS` and `gradle.properties`.

- The convention used for determining the name of the system property is `testlogger.<configuration setting>`.
- System property overrides will be applied after combining task and project level settings.
- Specifying a system property override will apply the same setting for all tasks, regardless of any configuration
defined in the build file.

### Switch themes

Expand Down Expand Up @@ -193,3 +232,21 @@ Yes. You will need to switch to a suitable parallel theme though. This can be on
`mocha-parallel`. The parallel themes are specially designed to work with a setting of
[`maxParallelForks`](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:maxParallelForks)
greater than 1. They achieve this by sacrificing the ability to group tests and thus some readability is lost.

### How are `testlogger` and `Test.testLogging` related?

Until recently, they were unrelated. While this plugin's `testlogger` has many properties named identical to the ones in Gradle's
`Test.testLogging`, to a large extent, they are kept isolated by design.

However, as of this writing `testlogger.showStandardStreams` property has been made to react to `testLogging.showStandardStreams`
property as long as one doesn't configure a value for `testlogger.showStandardStreams`. If a value is configured for
`testlogger.showStandardStreams` (even if it is `false`), the plugin ignores `testLogging.showStandardStreams` altogether.

### Can this plugin co-exist with junit-platform-gradle-plugin?

Due to certain unknown reasons, `junit-platform-gradle-plugin` is incompatible with `gradle-test-logger-plugin`. If you are still
using `junit-platform-gradle-plugin`, it might be worth noting that this plugin was [deprecated in JUnit Platform 1.2 and removed
from JUnit Platform 1.3](https://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle).

The test logger plugin however, is fully compatible with the [Gradle native way](https://docs.gradle.org/current/userguide/java_testing.html#using_junit5) of
using JUnit 5.
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
skip_tags: true
test_script:
- gradlew clean test --no-daemon
- gradlew build --no-daemon
after_test:
- ps: ./uploadTestResults.ps1
build: off
artifacts:
- path: build/reports/tests/test/**/*.*
- path: build/reports/tests/functionalTest/**/*.*
43 changes: 37 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@ sourceSets {
groovy {
srcDir 'src/test-functional/groovy'
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
}

test {
testClassesDirs += sourceSets.functionalTest.output.classesDirs
classpath += sourceSets.functionalTest.runtimeClasspath
systemProperty 'file.encoding', 'UTF-8'
}

dependencies {
compile gradleApi()
compile localGroovy()
Expand Down Expand Up @@ -76,3 +71,39 @@ idea {
testSourceDirs += file('src/test-functional/groovy')
}
}

test {
testClassesDirs += sourceSets.functionalTest.output.classesDirs
classpath += sourceSets.functionalTest.runtimeClasspath
systemProperty 'file.encoding', 'UTF-8'

testlogger {
theme 'mocha'
}

exclude 'com/adarshr/gradle/testlogger/functional/**'
}

task functionalTest(type: Test) {
maxParallelForks = 2
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.test.runtimeClasspath + sourceSets.functionalTest.runtimeClasspath
systemProperty 'file.encoding', 'UTF-8'
minHeapSize '128m'
maxHeapSize '512m'

jacoco {
append = true
destinationFile = file("${buildDir}/jacoco/test.exec")
}

testlogger {
theme 'mocha-parallel'
}

include 'com/adarshr/gradle/testlogger/functional/**'
}

tasks.check.dependsOn 'functionalTest'
tasks.functionalTest.dependsOn 'pluginUnderTestMetadata', 'testClasses'
tasks.functionalTest.mustRunAfter 'test'
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.5.0
version=1.6.0
group=com.adarshr
2 changes: 1 addition & 1 deletion gradle/coverage.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jacoco {
toolVersion '0.7.9'
toolVersion '0.8.2'
}

jacocoTestReport {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 450dc74

Please sign in to comment.