Page 1 of 1

Bind parameter values from CSV

Posted: Tue Aug 30, 2016 10:25 am
by giuseppe.lacagnina
Dear All,

I have the following problem. I want to get the values of my global parameters from a CSV file. This is clear enough in the documentation. Suppose I have a single global paramer, let us call it param_a. My solution has many test cases inside, and they all use this param_a

I have a CSV file with

param_a
1
2
3

What I would like is that test_case_1 uses the first value (1), test_case_2 uses the second value (2) and so on.
Is this possible?

What I do NOT want is to have one execution of ALL test cases per line of the CSV (3 runs).

Is that possible?

Thanks in advance!

Re: Bind parameter values from CSV

Posted: Tue Aug 30, 2016 11:22 am
by Martin
I think that you will have to create custom CSV data binding for this. I believe that you will not be able to iterate over the data column in the CSV file over multiple test cases in a single iteration.

One possiblity would be to create a module and inside that iterate all the data to be stored in variables/global parameters. And then continue on with the test cases.

So the structure would be something like this:

Test solution
-CollectDataTestCase // Iterates through the CSV data column and store data to variables/global parameters
-Testcase1
-Testcase2
-Testcase3

Regards
Martin

Re: Bind parameter values from CSV

Posted: Tue Aug 30, 2016 11:25 am
by giuseppe.lacagnina
Thanks, I will make some experiments and check.

Giuseppe

Re: Bind parameter values from CSV

Posted: Tue Aug 30, 2016 2:31 pm
by krstcs
If you just want to read the values, instead of trying to put the data in global params, you could just create a wrapper test case and bind the CSV data there.

TestSuite - GlobalParams
--TestCaseWrapper - CSVDataConnector
----ActualTestCase

Re: Bind parameter values from CSV

Posted: Tue Aug 30, 2016 2:34 pm
by giuseppe.lacagnina
Thanks!
The question was actually from a colleague.
I will propose this.
All the best
Giuseppe