Environment aware datasources

bssvulnbssvuln Posts: 4

I'm working with simple csv or excel file datasources and I want to be able to use different paths (\${environment_name}\source.csv) or settings depending on the environment I'm current using in the project/test, however environment values like ${name} are not being recognized. I do see some remarks on the help pages about this but my question is if it is posible to make this type of datasources environment aware. If not then whats the best practice used to solve this?



  • benken_parasoftbenken_parasoft Posts: 895 ✭✭✭

    In data source editors, you may need to use "soa_env" prefix like ${soa_env:var_name}.

  • bssvulnbssvuln Posts: 4

    I'm creating a global datasource and setting the path to c:/ds/${soa_env:NAME}, that doesnt sit well with soatest

    And when I try to use it anyways, it also doesnt work.

    is the scope of the datasource relevant?

  • benken_parasoftbenken_parasoft Posts: 895 ✭✭✭

    It depends what you mean by "environment variable". System/OS environment variables vs SOAtest tst environment variables. In your case, I think you want ${env_var:NAME}.

  • jakubiakjakubiak Posts: 671 admin

    If you are talking about SOAtest environments (as opposed to OS environment), I think the problem is because you are trying to use an environment defined in a .tst file in a global data source which is defined outside of any .tst file. Global data sources will not be able to resolve environment variables defined within a .tst. You would need to add your data source inside your .tst file to do that.

  • bssvulnbssvuln Posts: 4

    I wasnt clear, thanks @jakubiak for reading between the lines.
    I was trying to use a global datasource for many fixtures. I can use environments and local datasources, that seems to work with env_var. Thanks both.

Sign In or Register to comment.