Forum Discussion
- URN123Occasional ContributorThanks "nmrao".
Can you also provide me the groovy statement to be used to set the file path inside the datasource test step? - nmraoChampion Level 2You saw how to get a value of property, opposite of it to set. Use setPropertyValue(key, value)
- juliandiazdepooRegular Visitor
Rao, thanks for your explanation! Nevertheless, I did not figure out a way to put the file in the datasource-File. Can you pls support?
Thanks in advance,
Julian
- AsishRegular Visitor
Try this -
def dataSourceStep = testRunner.testCase.getTestStepByName("DataSource");
dataSourceStep.getDataSource().setFileName("FilePath");
Cheers,
Ashish
- nmraoChampion Level 2You may add a property at test case level for the same(say FILE_NAME) and access its value in groovy script of the test case.
def fileName = testRunner.testCase.getPropertyValue('FILE_NAME')
In case if it requires multiple files, define property(FILE_NAMES) value as comma separated(/path/to/file1,/path/to/file2) then split it using comma in the groovy script so that you get an arry and then loop thru it.def fileNames = testRunner.testCase.getPropertyValue('FILE_NAMES')
def fileNamesArray = fileNames.split(',')
fileNamesArray.each { fileName ->
//do the stuff
}
Related Content
- 7 years ago
Recent Discussions
- 11 days ago
- 14 days ago