Forum Discussion

mjlamora's avatar
New Contributor
3 years ago

Excluding project-level properties from source control

I have a project-level property that is a unique value across various team members and needs to be frequently updated. I am trying to exclude this value from our source control, which is managed via git integration. ReadyAPI saves the property and its value in settings.xml.


Other properties (test suite level, or test case level) have a checkbox to store the values locally per user, which exactly meets my needs -- BUT this checkbox is disabled for project-level properties. (See image attached.)



I would set the property at the test suite level, but the value varies by environment, which is a distinction that is only made at the Project level.


I've considered adding settings.xml to a .gitignore file, but there are other values within that file that we'd like to maintain in source control.


Any suggestions on a clean solution for this?

Thanks in advanced for the review and input.

1 Reply

  • JoostDG's avatar
    Frequent Contributor

    Hi mjlamora .


    I think your issue has already been addressed in this forum previously. See this post :


    Since that post, there is now indeed a way to exclude test suite & test case variables, so you should exclude those from that script.


    You could, on top of that, also use a setup script (or equivalent load script) that loads in project properties from a file that is located in a git repo dedicated folder (which you can gitIgnore later). See below example where I have a file in folder "datasource".

    Content should be like this:


    I got the original code form someone else, so I don't take credit for that. Together with that save script this should solve your question I believe.


    setup script

    def projectpath = project.path
    project.setPropertyValue("projectpath", projectpath)
    def testDataPath = project.path + "/datasource"
    // Load properties from file. These properties can be used across the different environments.
    def props = new Properties()
    //replace the path with your file name below. use / instead of \ as path separator even on windows platform.
    new File(testDataPath + File.separator + "").withInputStream { s ->
    props.each {
        project.setPropertyValue(it.key, it.value)