Forum Discussion

RUDOLF_BOTHMA's avatar
RUDOLF_BOTHMA
Community Hero
6 years ago
Solved

Using a test Parameter as part of a code expression value

Afternoon all !

 

Today is just a thought on whether there is a cleaner way...

 

I want to call a script inside my KWT.  It takes an array of strings.  Each one of the elements comes from a seperate test parameter.  Is there a method to use a parameter directly in a code expression or will I have to set up a variable for each parameter, assign the variable then use the variables in my code expression ? 

 

Just for interest sake.  This is what the KWT does and why an array is preferable

 

I have a KWT that takes 16 parameters.  Each one of these parameters is used to set the text of a specific control on the page.  I also have a script that takes an array of values which it can loop through and use to populate the relevant controls.  There is a good reason you would want to do that.  Due to the page structure, finding a combobox takes quite some time.  Each time I want to put data in, it takes 5 seconds, so 80 seconds to enter one row of data.  I can't use name mapping, which admittedly will be faster, since it's a grid which has an unknown number of rows.  Also,any of the rows can currently be editing.  Perhaps row 50? I'm not mapping 50 rows individually :smileyfrustrated:  If, however I send an array and which row I 'm editing as parameters, the script gets the container and can, inside of this container object, search for one control at a time using .Find, regexp etc. and set it.  So, 4 seconds to find the container, 1 second per combobox = 20 seconds.  One minute saved per KWT run.  Kerching!  I will only have to run the KWT 1500 times to make back the time I spent writing the script :smileytongue:

  • Let's say your keyword test is named MyTest

     

    So, to use a parameter in a code expression, you'd call

     

    KeywordTests.MyTest.Parameters.MyParam

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Let's say your keyword test is named MyTest

     

    So, to use a parameter in a code expression, you'd call

     

    KeywordTests.MyTest.Parameters.MyParam