Forum Discussion

anilqa10's avatar
anilqa10
New Contributor
13 years ago

How to call a function of other script unit by method name as parameter in C# script?

I want to invoke functions in other script unit by function name as parameter.



Hint:

       In VBSCRIPT we can perform the same operation using EXECUTE statement but i     am new to C# script.



3 Replies

  • anilqa10's avatar
    anilqa10
    New Contributor
    hi Murugan
    Thanks for your reply i will use the above method.


    I am designing new automation framework using TestComplete c# scripting where
    we write the script in excel file same like QTP keyword driven framework as shown below

    TC_ID TC_NAME OBJECT_NAME ACTION INPUT_PARAMETERS
    1 TEST Aliases["Test"]["UserName"] Set Anil
    Aliases["Test"]["Password"] Set *******


    in above scenario i will take object name in one variable say var a
    and i would like to perform the operation like

    var a
    a=objWorksheet.cells(2,2) //Aliases["Test"]["UserName"]
    a+".["SetText"]("Anil")"


    can i perform above operation using eval function?

    in VBSCRIPT we can use execute statement for this operation
    Execute "a.["""SetText"]("""Anil""")"
    i am new to TestComplete and c# scripting so i need help in implementing above operation.
  • anilqa10's avatar
    anilqa10
    New Contributor
    hi Murugan,

    Thanks for your reply i will use the above method.



    I am designing new automation framework using TestComplete c# scripting where I need to write the script in excel file same like QTP keyword driven framework as shown below





    TC_ID      TC_NAME      OBJECT_NAME                          ACTION      INPUT_PARAMETERS

    1             TEST             Aliases["Test"]["UserName"]        Set              Anil 

                                        Aliases["Test"]["Password"]         Set              *******



    in above scenario i will take object name in one variable say var a and i would like to perform the operation like



    var a a=objWorksheet.cells(2,2)            //Aliases["Test"]["UserName"]

    a+".["SetText"]("Anil")"



    can i perform above operation using eval function?



    in VBSCRIPT we can use execute statement for this operation

    Execute "a.["""SetText"]("""Anil""")" 



    i am new to TestComplete and c# scripting so i need help in implementing above operation