Forum Discussion

hendrik_schreib_1's avatar
hendrik_schreib_1
New Contributor
10 years ago

Pass many paramaters to a script function


We have to pass many test parameters from keyword tests to script functions. Unfortunately we cannot directly use script functions and we can't use keyword test variables. This is because of a dependency to another test tool.


 


Is there any possibility to loop over the test parameters, build an array and pass this array to the script test? Or is there any possibility to loop over the test parameters in a script function?



4 Replies

  • Alas, no, I have no solution for you.  Access to the keyword test parameters is only available from within the keyword test.  I haven't been able to find a way around this restriction.



    Let's re-examine the problem....  *Must* you call the keyword tests directly?  Can you instead call a script function directly?  The script function could do whatever you need to do with the parameters and then call the keyword test with the original params...

  • If you can't use KeywordTest variables, I'm not sure how you might loop over your test parameters to try to stuff them into some object.  Where will you put the object?



    To try to use a parameter processing script function to package your parameters will require that the number of arguments in the script function exactly match the number of parameters in the Keyword test.  If you have to write special case scripts to process your KeywordTest parameters, why don't you just call the target script function directly from within the parameter processing script function?



    Your problem seems overconstrained.


  • Sorry, my explanation was very short and incomplete. I try it again :)


     


    We use a proprietary test ware management tool to write test cases (SQS TestCenter). These test cases are connected to keyword tests in TestComplete. 


     


    To execute the test cases the test ware management tool calls the connected keyword tests. The defined test data is passed as test parameters of the keyword tests.


     


    In special cases we need to pass this data further on to script functions e.g. checking a table row with many columns. For each column exists a test parameter which has to be passed to the script function as a parameter. 


     


    The script function itself generates an array out of the passed test parameters and calls a generic script function which iterates over the table and the passed array.


     


    Due the high parameter count, the effort to maintain and write the script functions is very high. Therefore we want to write a generic script function which is called by the Keyword Test which iterates over the test parameter of the Keyword Test - e.g.:


     


    function checkTableRow (KeywordTest) {


     


    var arrIdentifyRow = Array(KeywordTest.Parameters.Length)


    {


      for (var i = 0; i < KeywordTest.Parameters.Length; i++)


      {


           arrIdentifyRow(i) = KeywordTest(Paramters)(i);


      } 


     


    ...


    }


     


    I have read this is not possible due access restrictions during runtime. Is this correct and is there any other possibility?