Forum Discussion

sgarcia's avatar
sgarcia
Contributor
8 years ago

Excel Driver not passing particular parameter value

I'm having an issue with the excel driver not passing a fifth parameter for a given call to a keywordtest. What I've found is a previous test call that requires passing eight parameters will cause this particular test to pass an empty string at the fifth parameter. These tests calls are five lines apart from each other. Here's the test flow from the excel file:

 

(problem)Keyword 1, param1, param2, param3, param4, param5, param6, param7, param8

Keyword2, param1, param2, param3, param4, param5, param6, param7

Keyword3, param1, param2, param3

Keyword4, param1, param2, param3

Keyword5, param1

(failed)Keyword 6, param1, param2, param3, param4, param5

 

Excel Driver subroutine below:

 

Note: 'VariableToStr' is a conversion function

 

Sub Main(ExcelFileName)

  Set Driver = DDT.ExcelDriver(aqConvert.VarToStr(ExcelFileName), "Sheet1",True)   

  While Not Driver.EOF
      Case "Keyword 1"
        Call KeywordTests.Test1.Run(VariableToStr(Driver.Value(1)),VariableToStr(Driver.Value(2)),VariableToStr(Driver.Value(3)),VariableToStr(Driver.Value(4)),VariableToStr(Driver.Value(5)),VariableToStr(Driver.Value(6)),VariableToStr(Driver.Value(7)),VariableToStr(Driver.Value(8)))   

 

      Case "Keyword 6"
        Call KeywordTests.Test2.Run(VariableToStr(Driver.Value(1)), VariableToStr(Driver.Value(2)), VariableToStr(Driver.Value(3)), VariableToStr(Driver.Value(4)),VariableToStr(Driver.Value(5)))

 

  WEnd
  Call DDT.CloseDriver(Driver.Name)
 

 If I remove Keyword1 from excel test script, Keyword6 gets the last parameter value passed to it as expected otherwise it comes back with an empty value. I don't get a runtime error for wrong number of parameters, so it's seeing the parameter itself. 

 

I have tried created new excel file and changing data type in cells. I've run the same test from within TestComplete, using a keywordtest to execute the other keywordtests and it runs fine. It only has issues when trying to pass the value from the excel test script. I've never run into this problem before and I'm at a loss as to what is causing this.

 

Any ideas?

 

Thanks!

 

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Is VariableToStr your own function you wrote?  Any reason why you're not using aqConvert.VarToStr?

     

    In any case, the way that the driver works is that it uses whatever the top value is in the spreadsheet to determine how to read the rest of the values in that column.  So, if param5 is an integer an integer in row 1 and a string in row 6, it's going to try and read it as an integer and may return it as a blank since NAN converted to string is blank.

     

    Try explicitly formatting the values in your spreadsheet to the format you want.  So, explicitly make the values integers, strings, etc.