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.

Select to Data Source from DB call

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
How is this done?
How can I fill a table, and then use the data from that table?

Can I use a setup test to query a Database and populate a SOATest Table?

eg :

SELECT
H.MSG_ID,
H.MESSAGE_TYPE
FROM dbo.HOLD_QUEUE As H
WHERE
H.MESSAGE_KEY_TXT = '$[Key]'
AND
H.MESSAGE_TYPE In ....

Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited December 2016
    Options
    There are two ways of going about this. We have a Database type of data source where you can enter your query and it will retrieve the resultset in a table format which you can then utilize to parameterize your tests. The Database data source does work like a setup test in the sense that it is refreshed/run first prior to any other tests.

    An alternative way is to use a DB tool and chain an XML Data Bank to the DB tool where you can extract specific values that you've queried.

    I believe the former suggestion would suit your needs more due to the nature of the SQL query which I believe will return a rather large resultset. With the latter approach you would have to manually extract each desired value from the resultset which may not be feasible in this case.

    For more information on Database data sources and XML Data Banks, please refer to our documentations (Help > Documentation or F1) under Available SOAtest Tools > XML Tools > XML Data Bank and Functional Testing (Emulating the Client) > Using Data Sources in Test Suites (Parameterizing Tests) > Adding a Database Data Source respectively.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited December 2016
    Options
    This is a great solution,
    But can I use a variable in my SQL select?

    In a DBtool it is possible to use Variable values from a Writable (or other) Data source,

    the Database data source doesn't seem to supprt this.

    Am i correct in this assumption?

    to be more clear

    this SQL
    SELECT MSG_ID
    FROM dbo.HOLD_QUEUE
    WHERE
    SILS_ID = '$[SILS_ID_TEMP: SILS_ID]'
    AND
    SILS_TRACKING_ID = '$[SILS_ID_TEMP: SILS_TRACKING_ID]'
    AND
    SUBJECT_NM LIKE '%SOATest%'
    ORDER BY
    MSG_ID

    _________________________________________

    works fine in a DBTool Test type,
    but if Plug this into a Database Data Source Sql Query, it doesn't allow for the Variables.

    Thanks in advance.

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited December 2016
    Options
    Your assumption is correct. Currently the DB tool only supports dereferencing data source columns in the query. The reason being is that the database data source is similar to a set-up test, meaning it should be run and populate the database data source prior to standard tests being executed, which may be driven by the database data source.

Tagged