Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

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

Options

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_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    edited August 2018
    Options

    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.