-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Description
Environment variables are read only during first gradle run. Subsequent runs ignore changes.
Steps to reproduce
(I've omitted superfluous output and used ellipsis ...
to shorten output)
(I'm invoking explicitly clearReports
and aggregate
to avoid distractions due to a fixed plugin issue)
-
Make sure you have a working test set and a valid serenity configuration, and that no gradle daemon is running:
$ git clone git@github.com:serenity-bdd/serenity-junit-starter.git Cloning into 'serenity-junit-starter'... ... $ cd serenity-junit-starter/ $ git checkout 5d5b01a ... HEAD is now at 5d5b01a Merge pull request #26 from mariagomgod/master $ ./gradlew --stop
This should generate valid reports:
$ ./gradlew clean clearReports test aggregate ... BUILD SUCCESSFUL in 25s 6 actionable tasks: 5 executed, 1 up-to-date
Features
should appear inindex.html
3 times:$ grep 'Features' target/site/serenity/index.html | wc -l 3
-
Kill all gradle daemons
$ ./gradlew --stop ... 1 Daemon stopped
-
Change
serenity.test.root
to something invalid and create reports$ sed "s/starter/starterXXX/" -i src/test/resources/serenity.conf $ ./gradlew clean clearReports test aggregate
When broken,
Features
is not present inindex.html
(this is expected)$ grep 'Features' target/site/serenity/index.html | wc -l 0
-
Set
serenity.test.root
back to its correct value and create reports again$ sed "s/starterXXX/starter/" -i src/test/resources/serenity.conf $ ./gradlew clean clearReports test aggregate
Features
should appear in index.html 3 times. These reports are broken! (unexpected)$ grep 'Features' target/site/serenity/index.html | wc -l 0
-
Create reports outside the gradle daemon
$ ./gradlew --no-daemon clean clearReports test aggregate
These reports looks OK (expected):
$ grep 'Features' target/site/serenity/index.html | wc -l 3
Analysis
Since gradle 3.0+ is the gradle daemon enabled by default (see https://docs.gradle.org/3.0/release-notes.html#improved-gradle-daemon,-now-enabled-by-default), and the plugin is run inside gradle's jvm. Unfortunately the configuration is created by guice as singleton only during first run and subsequent invocations of the plugin reuse the configuration.