Let us say that, you have automation script in which you want externalize URL and other attribute to a properties file.
One way to do is, write a Java class that will read properties file and then have the method replacing hard coded value that will read it from properties file.
Shortcut for this is,
Right click on empty area in eclipse, and select Source --> Externalize Strings...
In the window that is displayed, check all the values that you want to move to a properties file and rename key if required.
Select 'Next' and you will see automatic Java code that will be generated.
And finally 'Finish'.
Now, in the code, you will see, value has been moved to a properties file. Also you could see properties file, and class that was created.
Hope this blog has been useful to you.
One way to do is, write a Java class that will read properties file and then have the method replacing hard coded value that will read it from properties file.
Shortcut for this is,
Right click on empty area in eclipse, and select Source --> Externalize Strings...
In the window that is displayed, check all the values that you want to move to a properties file and rename key if required.
Select 'Next' and you will see automatic Java code that will be generated.
And finally 'Finish'.
Now, in the code, you will see, value has been moved to a properties file. Also you could see properties file, and class that was created.
Hope this blog has been useful to you.
No comments:
Post a Comment