Forum Discussion

Uzumaki's avatar
Uzumaki
Occasional Contributor
13 years ago

Updating calls to script routines in keyword tests

Hi,



Scenario:

I do calls to a specific script routine that takes 3 parameters in my 300 keyword tests. I now want to update the script routine to take 4 parameters instead of 3. What is the simplest way of updating all of my keyword tests? Left unchanged all the keyword tests will fail because of the missing parameter.



Edit: The same also goes for keyword tests inside other keyword tests as they also take paramters.



Thank you!



/Joakim

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What scripting language are you using?  I believe it's possible in at least JScript and DelphiScript to implement "optional" parameters.  In JScript, I think you can just check to see if the parameter value is null and, if it is, assign a default value.  In DelphiScript, you assign the default value in the parameter declaration.  I'm not sure if VBScript supports "optional" parameters.



    The advantage to this is that you then don't need to update any of your "legacy" tests as the default values will then be used for your new parameter.



    As far as I know, though, there's no "find and replace" in Keyword tests... you need to manually update them all unless there's a feature that I'm not aware of (SmartBear support can confirm availability).  


  • Hi,



    If you want to increase the number of parameters in a KD test, you need to declare additional parameters maually. To make this dynamic, you can pass all the needed value via a single parameter in an array and build your test's logic on the item count in this array. Also, you can use a table variable to pass a variable number of parameters.