How to use environment variable to change Database Datasource tool?

needhelpneedhelp Posts: 11

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 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}\
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.


  • benken_parasoftbenken_parasoft Posts: 620 ✭✭✭
    edited September 2017

    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.

Sign In or Register to comment.