Forum Discussion

richie's avatar
richie
Community Hero
7 years ago

Query Regarding Using Properties File

Hi,

 

This is related to my previous query.

 

I'm trying to use an external properties file to populate a specific tag value in the XML I'm posting to a web service.

 

I was wondering about the possible format for the properties/values in the .properties file.

 

The example I've found appears to indicate the .properties file requires a name/value pairing and the name has to be unique - so each value will need a unique property name.

 

I was wondering if anyone knows if you can assign a single property name (e.g. SessionNumber), but within the properties file have a list of multiple values so that I can interate through each value each time I execute a looped testcase?

 

I was hoping I could define a property (SessionNumber) and say have a .csv or .xls with a column of multiple SessionNumber values that would use a single value each time the test case looped.

 

Has anyone done anything like this before or does each value require a unique property name?

 

 

Cheers to all!

 

rich

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Property file is flat file, does not allow hierarchy of key value pairs. And each key should be unique.
    If you have multiple values for a key, you can use comma separated value and do convert them into list later with additional coding.

    How about using a json file? which is natural fit.
    • richie's avatar
      richie
      Community Hero

      Sorry - forgot to say "thanks" for responding!

       

      richie

  • groovyguy's avatar
    groovyguy
    Champion Level 1

    If you want to use a properties file and load it into a properties test step, you have to have a unique name per property and cannot assign multiple values. You may want to look at using a DataSource for that specific property and/or a groovy script to customize the desired effect.