Comments (1)
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:
- close the IntelliJ Idea IDE first and then remove the
testHistory
directory - open the IntelliJ Idea again and open the same project and then run the
SystemPropertyIT
test
Result: the system property is then updated
Conclusion
- When running unit test or IT test with IntelliJ Idea IDE, the IDE indeed read system properties from the maven's
pom.xml
and cache those system properties - The system properties is cached only once, meaning IntelliJ Idea considers itself as a system, even if the system properties inside
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 thepom.xml
and then run the test to get the reflected changes
from java-from-scratch-to-advanced.
Related Issues (14)
- BootClassLoader is invisible to client
- add a simple integration test with pre-integration-test and post-integration-test configuration and run it first in command line and then in IntelliJ HOT 2
- refactor
- clean
- TDD workshop: TDD by Example > Part I
- LEARNING: environment variables configured inside failsafe-plugin and its working machenism in IntelliJ Idea
- LEARNING: aggregate of system property and environment variable test
- LEARNING : make a new project for practicing JPA and Hibernate HOT 3
- bug : jpa-hibernate : IT tests are not executed with mvn command HOT 1
- LEARNING: add maven-release-plugin and run it to generate tag into github repo
- jpa-hibernate: LEARNING: try to use HikariCP with standalone hibernate HOT 3
- javax-jpa-hibernate: LEARNING: use HikariCP and Narayana JTA in standalone hibernate
- jpa-hibernate: LEARNING: use custom JNDI InitialContextFactory and Narayana JTA in standalone hibernate in the Jakarta context HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-from-scratch-to-advanced.