Forum Discussion

googleid_118035's avatar
googleid_118035
Contributor
10 years ago
Solved

Does it’s possible to call function name from the Excel file and do the execution?

Hi All,



Does it’s possible to call function name from the Excel file and do the execution?

Ex;

Function been created and exists in Testcomplete (Using vb scripts or Jscripts).

Excel file contain the only the function names.

Testcomplete scripts will be able to get function name from the excel file and do the execution.



-----------

Thanks

Dev
  • Ya Possible. Just Call function with param values in excel



       Excel



        login(test)  'Call like this





    script



       Function login(param1)

      .....

      .....

      End function

4 Replies

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    this can be done by building ur own framework. u can also use macros in excel to run  tests from excel file.



    a sample code executes function from excel in vbscript

     

      Sub Global_Object_Reference



          Set  Exo=Sys.OleObject("Excel.Application")

          Set Wbo=Exo.WorkBooks.Open("E:\book1.xlsx") 'excel file path

          Set Wso =Wbo.WorkSheets("sheet1")  'sheetname

          functionname=wso.cells(1,1)    'gets cell one value

          ExecuteGlobal functionname  'executes function

         

    End sub



     refer this



    http://www.codeproject.com/Articles/137481/Test-Complete-Storing-of-Test-Data-in-External-Fil



    and build ur own approach
  • karkadil's avatar
    karkadil
    Valued Contributor
    Yes, it is possible by using eval function (JScript).



    However, you'll need to decide how to specify unit name where the function is located, so it might be tricky, but still possible.
  • Hi Murugan,



    Thanks, Its works. Just one more question, does it’s possible to call function with parameters?





    -----------

    Thanks

    Dev
  • murugans1011's avatar
    murugans1011
    Regular Contributor
    Ya Possible. Just Call function with param values in excel



       Excel



        login(test)  'Call like this





    script



       Function login(param1)

      .....

      .....

      End function