Using the var Type in C# Connected Applications

Applies to TestComplete 14.30, last modified on November 21, 2019
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.

C# 3.0 and later include the standard var type, and var is a contextual keyword. However, TestComplete JScript and C#Script tests use the var keyword to declare variables used in the test. As a result, there can be a conflict between the two meanings of var in C# Connected Applications.

To use the TestComplete var type in a Connected Application, add the using AutomatedQA.script; directive to the source file that contains the test code.

C#

using AutomatedQA.script;
...
var str = "My String";

Alternatively, you can use the fully-qualified name of the TestComplete var type:

C#

AutomatedQA.script.var str = "My String";

If the Connected Application uses any of the above-mentioned approaches, the var keyword is used to declare TestComplete test variables. Otherwise, var refers to the C# var type.

For more information on testing applications from Connected Applications with TestComplete, see Connected Applications - Overview.

See Also

Creating Connected Applications in C#
Connected Applications - Overview
Self-Testing Applications
Running Connected and Self-Testing Applications
Working With TestComplete via COM - Overview

Highlight search results