Giter VIP home page Giter VIP logo

Comments (1)

rxue avatar rxue commented on August 17, 2024

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:

  1. close the IntelliJ Idea IDE first and then remove the testHistory directory
  2. 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 the pom.xml and then run the test to get the reflected changes

from java-from-scratch-to-advanced.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.