Forum Discussion

DKumar04's avatar
DKumar04
Contributor
5 years ago
Solved

Unable to add methods as 'Test Items' when methods actually are actually written inside the class

This is important to my project

All my methods are written inside class

This actually creates a problem as I am not able to call methods on project 'Test Items' page

 

 

  • These are scripts, not application code.  While classes are useful in organizing the objects and such, in order for TestComplete to execute them, they need to be made available as a method or function external to the class.  This can be done with a simple wrapper like

     

    function runMyMethod(){
        var myObject = new myClass();
        myObject.Method();
    }

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    These are scripts, not application code.  While classes are useful in organizing the objects and such, in order for TestComplete to execute them, they need to be made available as a method or function external to the class.  This can be done with a simple wrapper like

     

    function runMyMethod(){
        var myObject = new myClass();
        myObject.Method();
    }