Bind parameter values from CSV

Ask general questions here.
User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Bind parameter values from CSV

Post by giuseppe.lacagnina » Tue Aug 30, 2016 10:25 am

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!

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Bind parameter values from CSV

Post by Martin » Tue Aug 30, 2016 11:22 am

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

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Bind parameter values from CSV

Post by giuseppe.lacagnina » Tue Aug 30, 2016 11:25 am

Thanks, I will make some experiments and check.

Giuseppe

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Bind parameter values from CSV

Post by krstcs » Tue Aug 30, 2016 2:31 pm

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
Shortcuts usually aren't...

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Bind parameter values from CSV

Post by giuseppe.lacagnina » Tue Aug 30, 2016 2:34 pm

Thanks!
The question was actually from a colleague.
I will propose this.
All the best
Giuseppe