Forum Discussion
8 Replies
Sort By
- SmartBear_SuppoSmartBear Alumni (Retired)There's a special workaround for this case. If you define the property "Filename" (note the lower case n!), you will get the relative file name there.
To get the file name, use the code
testRunner.testCase.getTestStepByName("YourDataSource").getProperty("Filename").value
... where "YourDataSource" is the name of your data source.
Hope this helps!
Manne, SoapUI developer - SmartBear_SuppoSmartBear Alumni (Retired)Hi,
You can access the filename with this script,
def name = testRunner.testCase.getTestStepByName("DataSource").getDataSource().getFileName()
log.info name
Thanks,
Jeshtha - Clear_Capital__ContributorFor the the response Jeshtha
This gives me the directory/folder path name to the file, without the file name.
gives me
..../xmlfolder/
what I want is
.../xmlfolder/myFile.xml - SmartBear_SuppoSmartBear Alumni (Retired)Hi,
I am sorry but this will fetch the filename,
def val = testRunner.testCase.getTestStepByName("DataSource").getDataSource().getFilter()
log.info val
Thanks,
Jeshtha - Clear_Capital__Contributorits fetching literally the filter, not the filename. Here is its output.
Thu Feb 27 14:22:17 PST 2014:INFO:*.xml
As you would see in the screen shot earlier, *.xml is the filter I am using to look for just xml file. - Clear_Capital__ContributorManne,
This worked. It answers my questions. Just curious if there is way to get the full path instead of just file name. I suspect I may need this in near future.
Thank you
Jignesh - Clear_Capital__ContributorNever mind, you had already replied on how to get the path in the first reply
def name = testRunner.testCase.getTestStepByName("DataSource").getDataSource().getFileName()
I am all good now.
Thanks again. - Clear_Capital__ContributorManne,
When I renamed
DataSource -> FileContent property to
DataSource -> Filename
Filename property now had data source file name (say myXYZ.xml ) . So the problem with that is, I am losing the content of myXYZ.xml . To fix that , I created two properties, with same DataSource configuration (Directory / Filename Filter)
DataSource -> FileContent to read the content of myXYZ.xml
DataSource -> Filename to get the name of myXYZ.xml
SoapUI does not name these names, there seems to be some conflicts. So my soap request started failing.
To fix this, I renamed the one of the properties
DataSource -> xmlContent to read the content of myXYZ.xml
DataSource -> Filename to get the name of myXYZ.xml
and this works now.
Just letting you know. Seems like the features of "Directory" datasource are not fully tested and baked in.
Thanks
Jignesh
Related Content
- 6 years agosanj
- 4 years agoMarkSchofer
Recent Discussions
- 22 hours agogroovyguy