MajorPart Property

Applies to TestComplete 15.31, last modified on March 17, 2022

Description

Use this property to retrieve the major version number that is embedded in the executable.

Declaration

FileVersionInfoObj.MajorPart

Read-Only Property Integer
FileVersionInfoObj An expression, variable or parameter that specifies a reference to a FileVersionInfo object

Applies To

The property is applied to the following object:

Property Value

An integer value that corresponds to the executable’s major version number.

Example

The following script demonstrates how you can obtain the version number of a process’s executable file and post this number and its individual parts to the test log:

JavaScript, JScript

function FileVerInfoSample()
{
  var verInfo = Sys.Process("TestComplete").FileVersionInfo;

  Log.Message("Version number: " + verInfo);
  Log.Message("Major: " + verInfo.MajorPart);
  Log.Message("Minor: " + verInfo.MinorPart);
  Log.Message("Build: " + verInfo.BuildPart);
  Log.Message("Private: " + verInfo.PrivatePart);
}

Python

def FileVerInfoSample():
  verInfo = Sys.Process("TestComplete").FileVersionInfo

  Log.Message("Version number: " + VarToStr(verInfo))
  Log.Message("Major: " + VarToStr(verInfo.MajorPart))
  Log.Message("Minor: " + VarToStr(verInfo.MinorPart))
  Log.Message("Build: " + VarToStr(verInfo.BuildPart))
  Log.Message("Private: " + VarToStr(verInfo.PrivatePart))

VBScript

Sub FileVerInfoSample
  Dim verInfo
  Set verInfo = Sys.Process("TestComplete").FileVersionInfo

  Log.Message "Version number: " & verInfo
  Log.Message "Major: " & verInfo.MajorPart
  Log.Message "Minor: " & verInfo.MinorPart
  Log.Message "Build: " & verInfo.BuildPart
  Log.Message "Private: " & verInfo.PrivatePart
End Sub

DelphiScript

procedure FileVerInfoSample;
var verInfo;
begin
  verInfo := Sys.Process('TestComplete').FileVersionInfo;

  Log.Message('Version number: ' + verInfo);
  Log.Message('Major: ' + VarToStr(verInfo.MajorPart));
  Log.Message('Minor: ' + VarToStr(verInfo.MinorPart));
  Log.Message('Build: ' + VarToStr(verInfo.BuildPart));
  Log.Message('Private: ' + VarToStr(verInfo.PrivatePart));
end;

C++Script, C#Script

function FileVerInfoSample()
{
  var verInfo = Sys["Process"]("TestComplete")["FileVersionInfo"];

  Log["Message"]("Version number: " + verInfo);
  Log["Message"]("Major: " + verInfo["MajorPart"]);
  Log["Message"]("Minor: " + verInfo["MinorPart"]);
  Log["Message"]("Build: " + verInfo["BuildPart"]);
  Log["Message"]("Private: " + verInfo["PrivatePart"]);
}

See Also

MinorPart Property
BuildPart Property
PrivatePart Property

Highlight search results