Open rxue opened 11 months ago
Tested environment: Linux and MacBook
Problem:
When running SystemPropertyIT
initially for the first time, the test will pass. But if the property x
of failsafe-plugin
is updated with another value in the pom.xml
the same test executed with IntelliJ Idea could still pass unexpectedly. Whereas, if the same is executed with mvn
command through terminal the update of system property can be reflected
Analysis:
My guess is the cache machenism of IntelliJ Idea : when running the test for the first time, the system property is read from the maven configuration file pom.xml
and then cached into IntelliJ Idea's cache, afterwards when the test is executed again and again, the same property value is retrieved from the cache and, the cache is not updated for the second even when the system property value inside pom.xml
's failsafe-plugin
is updated
Reference on the cache location of IntelliJ Idea: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
Trial and Full Proof on the Analysis
I tried to search for the cached property value from the cache location of IntelliJ Idea and found it from testHistory
. => Trial:
testHistory
directorySystemPropertyIT
testResult: the system property is then updated
Conclusion
pom.xml
and cache those system properties pom.xml
is updated sometimes. This might be a bug of the current IntelliJ Idea since sometimes developers might just need to update the system properties in the pom.xml
and then run the test to get the reflected changes
TODO Add a system property
x
infailsafe-plugin
of maven, then test it withIntelliJ
IDEReference: https://maven.apache.org/surefire/maven-failsafe-plugin/examples/system-properties.html