Forum Discussion

ucuber's avatar
ucuber
Occasional Contributor
7 years ago

CSV Parameter trickery in keywordtests

 Hi *,

 

- I'm working with a data driven loop, connected to a csv file.

- The file holds scenario data organized in the form scenario;device_name;input1;input2;...;expected1;expected2;...

- The scripted test (in python) has the parameters def test(scenario, device, **kwargs).

 

**kwargs should take a dynamic numer of key-value-pairs, the input and expected values. But the kwargs-part is not shown in the keywordtest as valid parameter to be filled with values.

 

With *args which resembles a dynamic list of pararameter values it is a little bit different, because the argument is shown, but I can only address a single value to the list. And it does something very weird with the Operations Parameters order: if i have scenario, device, *args it presents scenario, args, device and even when I connect the correct values it switches the order. When I omit the astersik, everything is as it should.

 

TL;DR;

I have to accept TestComplete does not really support these typical pythonic constructs **kwargs and *args as Operation Parameters in keyword tests that call scripted code.

 

What to do now? I do not want to name every possible field in the parameter list of the script because this is ugly, not pythonic and worst of all: the number of fields may change in the (near) future

 

So there must be a way in the data driven loop to tell TestComplete that it takes a whole row and adresses it to a single variable, whatever format. Does anyone have an idea?

 

Regards

 

Ulrich