Choosing a scripting language for the project

Choosing a scripting language for the project is the first important choice to make before creating a project. Choosing a language should be a careful and circumspect process, since it shall not be possible to change the choice in the future. If you would like to change the selected project's scripting language, you would have to redo the project from scratch!

How to do it...

In order to select a scripting language for a new project we need to perform the following steps:

  1. Start creating a new project (by selecting File | New | New Project).
  2. In the Language combobox, you will see a list of five languages available.
  3. Select one of them depending on your needs.

How it works...

TestComplete provides a possibility of choice from the following three programming languages: JScript, VBScript, and DelphiScript. Apart from these three languages, the following two are also available: C++Script and C#Script. The latter two languages are in fact the same as JScript, with somewhat modified syntax. That's why everything that goes for JScript is just as applicable for these two scripting languages also.

Note

The C++Script and C#Script scripting languages have nothing in common with C++ and C#! It's the same JScript with a slightly changed syntax. By using C#Script you will not have the possibilities extended in the C#! The same goes for C++Script.

The next important thing: if you are planning to create tests only in TestComplete and then launch them with the help of TestComplete (or with the help of TestExecute – a command-prompt utility), you can select absolutely any language, regardless of the application that you are about to test.

For example, you may use VBScript language to test applications coded in C#, or select DelphiScript to test web-applications. In any case, you will enjoy complete access to all the TestComplete possibilities. For example, to access standard .NET classes in TestComplete, there is a special dotNET object up for grabs. This object can be used in any programming language.

If you are already familiar with one of the languages suggested by TestComplete, selecting just that will be better for you. If none of the languages are familiar to you, the following tips may come in mighty handy:

  • VBScript: This language is very simple to learn, and therefore is recommended for beginners who are not proficient in programming.
  • JScript: This language (JavaScript engine from Microsoft) is a more powerful and flexible language in comparison to the VBScript; it also has more compact syntax and its code constructions are shorter and faster to type. JScript is recommended for those who have some programming background.
  • DelphiScript: This language is a procedural scripting language used only in TestComplete. Its syntax resembles a skimpy version of Delphi. It is recommended only for creation of connected and self-tested applications (see later in this chapter).

There's more…

Now, we shall consider why we need such languages as DelphiScript, C++Script, and C#Script.

TestComplete allows scripting in more advanced languages (C#, C++, Delphi, and Visual Basic). Meanwhile, you are using all the functionalities of a given language, writing up tests in any appropriate IDE, using the functionalities extended by TestComplete to gain access to the tested application. If you plan to record scripts with the help of TestComplete first and then convert them to tests in more advanced languages, you will need to apply these three languages. You can select a scripting language to comply with what it will be converted to (for example, C++Script to convert to C++code, DelphiScript for converting to Delphi). Having resolved that, the process of converting becomes hands-down easy. You will only need to make several similar changes in the code. In other cases, usage of the languages DelphiScript, C++Script, and C#Script is usually not considered expedient.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.77.63