Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
In this post, I will present a convenient way to work with properties file inside unit tests.
This way requires properties, which is a project on Gitgub.
(To find out how get started and install properties, please read their official documentation from the link above).

You have a properties file that is used in production. That means that production code depends on values in this file.
You want to use the same values in your test.



  1. In your test, you add an annotation before the class declaration:

  2.  You define a class member for each property that you want to use with the property annotaion
    private String your_property_variable;

  3. Add @Before method to your test class (if it doesn't exist yet) and add following line:

Now, in your test, you can access each property from properties file using an internal class member.