[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Collapse]Using TestComplete/viewarticle/57875/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/57876/
  [Collapse]Creating, Recording and Running Tests/viewarticle/56646/
   [Expand]Naming Objects/viewarticle/56265/
   [Expand]Creating Tests/viewarticle/57373/
   [Expand]Managing Tested Applications/viewarticle/57435/
   [Expand]Checkpoints and Stores/viewarticle/56266/
   [Expand]Running Tests/viewarticle/56462/
   [Expand]Handling Playback Errors/viewarticle/56641/
   [Expand]Keyword Testing/viewarticle/55462/
   [Collapse]Scripting/viewarticle/56245/
    [Collapse]Writing Scripts/viewarticle/56862/
      Writing Scripts - Overview/viewarticle/56520/
      Writing Scripts - Quick Start/viewarticle/58077/
      Selecting the Scripting Language/viewarticle/57892/
      Supported Scripting Languages - Specifics of Usage/viewarticle/57893/
      Calling Routines and Variables Declared in Another Unit/viewarticle/56539/
      Calling Routines Declared in Another Project/viewarticle/56535/
      Calling Methods Asynchronously/viewarticle/56676/
      Calling Project Items From Scripts/viewarticle/56558/
      TestComplete Helper Objects/viewarticle/56855/
      Handling Exceptions in Scripts/viewarticle/56480/
      Sending E-Mail From Scripts/viewarticle/56308/
      To Do Comments Format and Syntax/viewarticle/57706/
      Using Dictionary Object To Address Array Elements With String Indexes/viewarticle/58138/
      Using Namespaces/viewarticle/55020/
      Using Regular Expressions in Scripts/viewarticle/56414/
      Using Structures in Scripts/viewarticle/56861/
      Using Timers/viewarticle/55006/
      Working With COM Objects/viewarticle/56228/
      Working With COM Ports From Scripts/viewarticle/58080/
      Converting Scripts From One Scripting Language To Another/viewarticle/58076/
     [Expand]Working With Strings/viewarticle/58075/
     [Expand]Working With Time/viewarticle/58078/
     [Expand]Working With Dates/viewarticle/58079/
     [Expand]Working With Numeric Values/viewarticle/58074/
      Working With WMI Objects in Scripts/viewarticle/58097/
    [Expand]Using Code Editor/viewarticle/55044/
    [Expand]Using Code Explorer/viewarticle/62615/
   [Expand]Test Visualizer/viewarticle/55007/
   [Expand]Exploring Applications/viewarticle/55055/
   [Expand]Debugging Tests/viewarticle/56567/
  [Expand]Test Results/viewarticle/55010/
  [Expand]Enhancing Tests/viewarticle/56964/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/57266/
  [Expand]Extending TestComplete/viewarticle/57655/
  [Expand]Automating TestComplete/viewarticle/57438/
   TestComplete Tips/viewarticle/57877/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Expand]References/viewarticle/57878/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 4/23/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Writing Scripts

Selecting the Scripting Language

Each TestComplete project uses five supported scripting languages:

  • VBScript
  • JScript
  • DelphiScript
  • C++Script
  • C#Script

The scripting language for the project is specified at the project creation time and cannot be changed later (see Create New Project Wizard - Project Scripting Language Page ).

The scripting language is important even if you are not going to create test scripts. The scripting language also defines the syntax of script code snippets that you can use in keyword tests. Also, the scripting language defines the syntax of test object names in your tests. For instance, in VBScript and JScript, the name of the Notepad process looks like Process("Notepad"). In DelphiScript, you should replace quotes with apostrophes: Process('Notepad'); and in C++Script and C#Script, the word Process should be enclosed in brackets: ["Process"]("Notepad").

Which language to choose?

The supported languages are quite different, so you may ask “Which one should I choose for my project?” The answer is simple: choose the language you know better and that is closer to your development experience. This will decrease the test creation time, since you will not have to learn a new language. The rest of this topic contains answers to some typical questions that users ask when selecting a scripting language.

Should the scripting language match the language of my tested application?

No, a project’s scripting language does not depend on your tested application’s programming language. For instance, you can use JScript to test Visual C++ applications, or VBScript to test Delphi programs. There is only one recommendation: if you plan to create a Connected or a Self-Testing Application, you should select the scripting language that matches the development tool where you will create that application. That is, if you use Visual C++ or C++Builder, you should select C++Script; if you use Visual Basic, select VBScript; if you use C#, use C#Script, and if you use Delphi, select DelphiScript. This will make it easier to import recorded scripts to Connected and Self-Testing Applications.

Will my project be limited in functionality if I select this or that language?

No, it will not. The vast majority of TestComplete features is equally oriented on each of the five supported languages. So, you can choose the language that is closer to your developer skills.

Note however that the syntax of C++Script and C#Script differs from that of C++ and C#. So, selecting these scripting languages makes sense only if you plan to create a Connected or Self-Testing C++ or C# application. If you want to select C++Script or C#Script only due to that the C++ or C# syntax is closer to your skills, we recommend that you rather use JScript as its syntax is more similar to C++ and C# than the C++Script and C#Script syntax is.

Scripting languages have a different set of predefined functions. Why do you say the project will not be limited in functionality?

Yes, each scripting language provides a number of built-in functions that help you perform some routine actions, such as converting numerical values to strings and vice versa (C++Script and C#Script have the same functions as JScript, since these languages are based on JScript). Normally, the sets of predefined functions of different scripting languages are similar to each other, with few exceptions (for instance, DelphiScript does not have an analogue of VBScript’s split function). However, the difference in predefined functions is negligible, since most of predefined functions are simple and you can easily create their analogues in another language. Also, TestComplete provides an extensive set of scripting objects whose functionality covers the functionality of predefined functions. They can be used in any project, regardless of its scripting language.

What are the specifics of the supported scripting languages that may affect my tests?

As we have said above, you will not be limited in functionality if you prefer one language to another - you will be able to use all of TestComplete’s features regardless of which language you choose. However, due to the fact that languages have different syntax and work via different engines, there are few exceptions:

  • JScript does not support functions that obtain parameters by reference. The same applies to C++Script and C#Script since these languages work via the JScript engine.

  • Any of the supported scripting languages let you call routines and variables defined in another unit. However, circular references between units are supported in VBScript and DelphiScript only and are not supported in JScript, C++Script and C#Script.

  • Some users consider that exception handling in JScript, C++Script, C#Script or DelphiScript may be more convenient than exception handling in VBScript.

  • The format of arrays in JScript, C++Script and C#Script differs from the DelphiScript and VBScript (see Supported Scripting Languages - Specifics of Usage). This affects the usage of some routines (for example, the AddNamedChild method) in JScript, C++Script and C#Script code. For more information, see documentation for the specific method.

For more information on usage specifics of supported scripting languages, see Supported Scripting Languages - Specifics of Usage.

See also
Writing Scripts | Supported Scripting Languages - Specifics of Usage | Creating Projects and Project Suites | Create New Project Wizard - Project Scripting Language Page | Create Project Dialog


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document