Forum Discussion

ryanbulmer's avatar
14 years ago

Calling a function within a c++ app

I've created a testing application (C++ app) and I'm trying to figure out how to get TestComplete to automate the testing functions within it.  At a basic level I'm trying to get TestComplete to simply:

1) launch my application

2) execute my testing function (let's say I've got a class CMyClass with a method RunTest())

3) shutdown my application



I've been trying to setup a script or UnitTesting item to work but I can't seem to get anything to run my testing function.  All I've successfully done is get a script to launch and shutdown my app.



I've read through how to setup my application to be an Open Application.  If I create a UnitTesting item and use the Load command my class and function show up in the list of tests so I think I've setup my application properly.  Unfortunately several hundred other classes show up in the list and the list view doesn't seem to support multi-select so disabling or removing all the unecessary items is impractical.



All the examples I've looked at for scripts use windows and controls but my test function isn't related to any UI elements.  I've tried to access my class and function within a script but everything I've tried simply fails throwing an exception about non existent objects.



How can I get TestComplete to execute my testing function?

1 Reply


  • Hi Ryan,





    I recommend that you add a method that will return an instance of your test class to the class of the main application form. This will provide you with an ability to access your test class via a method of a GUI object that can be accessed from TestComplete.