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 use environment variable to change Database Datasource tool?

Options
needhelp
needhelp Posts: 11

Hi,
I want the Database Datasource Tool to automatically switch from DEV to QA and vice versa. I failed to do so.

Here are the step I have made:
under the project folder I have create a DEV and QA folder. each folder has db.properties file for the named environment.
1. Create a tst
2. Add 2 environment DEV and QA each of them have a variable name "Test_Env" and have the respective value.
3. set the environment DEV
2. Add a datasource of Database type
3. Select "Input file" at the field "Driver Class"
4. I have something like this ${project_loc: myproject}\${soa_env:Test_Env}\db.properties
5. save it
6. close the test
7. click on refresh
8. Open the test
9. click refresh once again on the suite root.
10. Open the datasource Database
11. then verify if the properties are loaded to the connection properties. However it does not see the file (this is my hypothesis).

Thank you.

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    edited September 2017
    Options

    However it does not see the file (this is my hypothesis)

    It would be good to describe exactly what you are seeing. You should be getting an error of some kind if something is going wrong, either when running your test suite or when clicking the Refresh button in the UI.

    In case this helps, if using environment variables for data source options seems troublesome then consider using a Data Group Data Source which provides a way to switch between different data source configurations. Search the User's Guide for details about how this works.