Parameterizing an Excel Spreadsheet Data Source name

rohitmohiterohitmohite Posts: 5

I want to parameterize the File Path of an ExcelSheet in DataSource. In Parasoft help option I found below options but in these options I didn't find the way to parameterize the name of .xls file. Can you please help me with it.

Specify the path to the Excel file in the File Path field. You can use the following variables:

• test_suite_loc: To specify a file path relative to the .tst file. For example, "${test_suite_loc}/../files/my_spreadsheet.xls"

• project_loc: To specify a relative path to a project. For example, "${project_loc:MyProject}/my_spreadsheet.xls"

• workspace_loc: To specify a relative path to a workspace. For example,
"${workspace_loc}/../files/my_spreadhseet.xls"

• SOAtest environment variables: Described in Using Environment Variables in Tests. For example,
${test_suite_loc}/../${soa_env:XLS_DIR}/my_spreadsheet.xls

Tagged:

Comments

  • Thomas MooreThomas Moore Posts: 63 admin

    Hi Rohitmohite,

    May I ask if we could take a step back and ask why you want to parameterize the filepath? One of the things that I immediately thought when I saw your question was wondering if you wanted to be able to change which excel sheet you were pointing to depending on the environment.

    If this is the case, you can do this quite easily by using multiple datasources, a data group, and environments.

    To do so, first you will want to create one excel datasource for each excel file you would be referencing. Then, create a single data group datasource and add each of the excel datasources in it. Once you have that, you can define the active datasource as a parameterized value, as shown in the screenshot below.

    Finally, create a number of environments equal to the number of excel files you want to reference, and define the datasource parameterized value you defined above in each environment. In my case, I created a variable called "datasource" in the two environments, with the values of DS1 and DS2, one in each environment.

    Now if I switch between the two environments, I get the values for each datasource respectively in my message client.

    Let me know if this is the type of functionality you are looking for :)

    Hope this helps!

Sign In or Register to comment.