Ask a Question

why is referencing datasource inconsistent when compared to referencing test suite variable

sanj
Super Contributor

why is referencing datasource inconsistent when compared to referencing test suite variable

ok when I reference a datasource I need something like:

${USAirportRefData#country}

but when referencing test suite variable ${#TestSuite#timeZone2}

Many times I left # in front for data source and of course what do I get nothing!

inconsistent_refdatasource.PNG

8 REPLIES 8
groovyguy
Community Hero

Is the DataSource in your test case, the same test case as the request? That's why you don't need the extra #. It is required for the TestSuite level properties, since ReadyAPI has to know to go up a level. 

 

Documentation for Property Expansion




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
nmrao
Community Hero

1. # is required for referring to Test Case / Suite / Project level properties

2. # is not required if you are referring to a name of Test step.


Regards,
Rao.

@nmrao: Doesn't 2 in your reply only apply to TestSteps at the same level as the test request? IE, they have to be in the same test case? That is an important distinction. 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

Most of the times, I use Type 1.
Never remember using 2nd type.
Thumb rule, which I follow, each test case independent. So, the case you mentioned does not arise or I never used as mentioned.


Regards,
Rao.
sanj
Super Contributor

@groovyguy yes data source is at test case level.

 

So it's in the same test case as the request you are using, then the property expansion should always be ${DataSourceName#PropertyName}. If that's the case, are you saying you still get sometimes where that doesn't evaluate or returns a null/empty string? 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
sanj
Super Contributor

yup 

The only time I've seen that is if my test case is not running the Data Source to load data. Did you try selecting the "Preload data if available" option on the Data Source?




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
cancel
Showing results for 
Search instead for 
Did you mean: