Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Kotlin DSL #200

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ buildscript {
apply plugin: 'com.adarshr.test-logger'
```

Note: Test logger 2.x is incompatible with Gradle 4.x; please use test logger 1.7.1.
### Compatibility matrix

| Test logger version | Minimum Gradle version |
|---------------------|-----------------------------|
| 1.x | 4.x |
| 2.x | 5.x |
| unreleased | 6.x |

## Configuration

Expand Down Expand Up @@ -303,6 +309,49 @@ corresponding property of `Test.testLogging`. The below table demonstrates this
In other words, an explicitly configured `testlogger` property, despite it being `false`, takes precedence over any
value of `Test.testLogging`.

## Kotlin DSL

If you are using the Kotlin DSL, the syntax of `testlogger` extension DSL changes slightly. The following shows the default
configuration properties using Kotlin DSL style.

```kotlin
testlogger {
theme = ThemeType.STANDARD
showExceptions = true
showStackTraces = true
showFullStackTraces = false
showCauses = true
slowThreshold = 2000
showSummary = true
showSimpleNames = false
showPassed = true
showSkipped = true
showFailed = true
showStandardStreams = false
showPassedStandardStreams = true
showSkippedStandardStreams = true
showFailedStandardStreams = true
logLevel = LogLevel.LIFECYCLE
}
```

One gotcha about Kotlin DSL is that if you have subprojects that are trying to use a different testlogger setting compared to
the parent project, the syntax changes slightly.

```kotlin
subprojects {

apply {
plugin("com.adarshr.test-logger")
}

configure<TestLoggerExtension> {
theme = ThemeType.STANDARD
showExceptions = true
...
}
}
```

## FAQ

Expand Down