Forum Discussion

kalmangt's avatar
kalmangt
Occasional Contributor
8 years ago

Invalid Number of Paramters

Don't know what I am doing wrong but I am trying to use an If..Then...Else statement that used to work in TestComplete v11.  I have upgraded to v12 and no matter what I do the test fails and displays the error "Invalid number of parameters".  I am trying using a data driven test and I have data in my excel spreadsheet that works everywhere else on my form except when I am trying to test for and select either a Male or Female gender button based on what I have in my spread sheet.

 

Basically I have it like this:

If....

Value 1 is set to:  ProjectSuite.Variables.Donation_Data("Gender")

Condition:  Equals

Value2:  Male

 

Then...

Select the Male button

 

Else...

Select the Female button

 

what other parameters am I missing??????  any help would be appreciated!!!

 

  • I'm assuming that the function you posted, when you did it as a keyword test, was being called inside a Data-Driven loop like so..

     

     

    so... your call to the data field of Gender IS correct... that means, then, that the problem is not in the gender call but something within the subsequent logic of clicking the buttons.

    As a diagnostic, try just doing a quick script record of clicking on the buttonMale and see how it shows up. It's entirely possible that "ClickButton()" might not be the correct method call...  If you don't want to try to record, try replacing "ClickButton()" with just "Click()"and see if that corrects it.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Agreed with bbi. You've given us the data that you are parsing out of your source file, however, we don't know what code is executed. The "invalid number of parameters" most likely corresponds to some sort of method call in your script code that is expecting some parameters that are non-optional... bbi ran into EXACTLY that situation and the solution was to alter the code to make sure the correct number of parameters were being used.

      • kalmangt's avatar
        kalmangt
        Occasional Contributor

        It was originally created as a keyword test, but I converted it to a script.  What is the correct # of parameters for this statement?

         

        Thanks again.