How to get name of DataSource using Java code / Groovy Scripting?

AshwinGawandeAshwinGawande Posts: 2

For my framwork I want to fetch Datasource name from java code in string format. Is there any context method to do so?

Comments

  • benken_parasoftbenken_parasoft Posts: 552 ✭✭✭
    edited August 27

    For my framwork I want to fetch Datasource name from java code in string format

    From the scripting API, you reference things by their name. A test suite can have multiple data sources. So, you need to know the name of the data source you want to work with in order to query columns from it. Similarly, you generally need to know the column names if you want to select a specific value. If you are planning to write a script that can work with different data sources then perhaps you should pass the name of the data source into your script in some way. For example, perhaps you can define a test suite variable called "dataSourceName", set it to the name of the data source you want, then lookup that variable from your script.

    Just in case this helps you, the SOAtest server has a REST API that can be used to query, create, and modify test assets including test suites and data sources. See my earlier response about the java client we have for this: Read .tst file using java.

Sign In or Register to comment.