The System. setProperty() method forms the basis for test case automation on any browser. Naturally, QAs must understand how to use this fundamental method for all automation purposes in Selenium.
To get a specific system property, we can use the System. getProperty() method while to fetch a specific environment variable, call the System. getenv() method. System properties can be added at runtime using System.
The getProperty method returns a string containing the value of the property. If the property does not exist, this version of getProperty returns null.
I am refering to the question on changing the classpath programmatically.
I read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties().
The answers however I got was that It Wont work. I have not tried this myself, however, i am taking the call.
Just to clarify, then why these setProperty() and getProperty() methods are there if they cannot alter it at run time. Or is this specific to the classpath property only ?
I will appreciate if someone can present a scenario where they are really helpful?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With