Information in this topic applies to desktop applications only. |
Connected and Self-Testing applications are deprecated. These technologies will be removed in one of the future releases of TestComplete. To create test code that runs from within your tested apps, use TestLeft, a SmartBear functional testing tool for developers. |
TestComplete allows you to embed script code within your applications, making them Connected Applications.
To post messages, images, files and references to the test log and to create folders in the test log from Connected Applications, you can use the same script instructions that you use in TestComplete scripts. For example:
TestComplete Script | Connected Application |
---|---|
VBScriptCopy Code Sub TestProc
Log.Message "Message1" Log.Message "Message2" Log.Message "Message3" End Sub |
Visual BasicCopy Code Sub TestProc
Log.Message "Message1" Log.Message "Message2" Log.Message "Message3" End Sub |
C++ScriptCopy Code function TestProc()
{ Log["Message"]("Message1"); Log["Message"]("Message2"); Log["Message"]("Message3"); } |
C++Copy Code void TestProc()
{ Log["Message"]("Message1"); Log["Message"]("Message2"); Log["Message"]("Message3"); } |
DelphiScriptCopy Code procedure TestProc;
begin Log.Message('Message1'); Log.Message('Message2'); Log.Message('Message3'); end; |
DelphiCopy Code procedure TestProc;
begin Log.Message('Message1'); Log.Message('Message2'); Log.Message('Message3'); end; |
C#ScriptCopy Code function TestProc()
{ Log["Message"]("Message1"); Log["Message"]("Message2"); Log["Message"]("Message3"); } |
void TestProc()
{ Connect.Log["Message"]("Message1"); Connect.Log["Message"]("Message2"); Connect.Log["Message"]("Message3"); } |
As you can see, there is almost no difference.
When calling TestComplete functions from your Connected Application, you may want to use some constants defined in TestComplete. For instance, you can use the pmLower
and pmHigher
constants when posting messages to the log. These constants are defined in source files that you add to your Connected Application project (for example, script.h for C++ projects or TCConnect.pas for Delphi projects).
Note that before you start posting messages from your Connected Application, the TestComplete test log and other TestComplete subsystems must be properly initialized. The initialization is performed when you start the script run in TestComplete. That is why Connected Applications should be started by TestComplete scripts (to be more exact, a TestComplete script must be running when a Connected Application starts running its scripts). For more information, use the following links:
Creating Connected Applications in Microsoft Visual C++ and Borland C++Builder
Creating Connected Applications in Microsoft C#
Creating Connected Applications in Microsoft Visual Basic 6.0
Creating Connected Applications in Microsoft Visual Basic .NET
Creating Connected Applications in Borland Delphi
To start a TestComplete script from your application, connect to TestComplete via OLE and initiate the script run with the RunRoutine
method of the Integration
object. For more information, see Working With TestComplete via COM - Overview.