12. Deploying the Extension

Applies to TestComplete 15.70, last modified on December 17, 2024

When the description.xml file and the script code are ready and tested, we can package them into a single extension file and deploy this package file to users.

Script extension packages are ZIP files that have the .tcx extension. So, to create a script extension package, you need to pack the files to a ZIP archive and change the archive’s extension from .zip to .tcx.

In our case, the extension’s file name should be LogAttrExtension.tcx. We will use this name, since we named the help file LogAttrExtension.chm and this name must coincide with the extension’s file name. If you wish, you can use any other name, but, you have to rename the help file and also correct the laEditForm_btnHelp_OnClick routine in the laCode.js unit. Note that the help file name must not contain spaces.

Before packing the extension’s files, make sure that all of them reside in the same folder. In our case, all of the following files must be located in the C:\My Extension Files\LogAttrExtension folder:

  • description.xml
  • laCode.js
  • la-icon.bmp or la-icon.png
  • laEditForm.aqfrm
  • LogAttrExtension.chm

You can pack the files using any tool that supports the ZIP format. You can even use TestComplete since it supports the zip packer functionality included in the operating system. To pack the files, you can use the following script code:

JavaScript, JScript

function PackFiles()
{
  var FolderName = "C:\\My Extension Files\\LogAttrExtension";
  var FileNames = slPacker.GetFileListFromFolder(FolderName);

  slPacker.Pack(FileNames, FolderName, FolderName + "\\LogAttrExtension.tcx");
}

Python

def PackFiles():
  FolderName = "C:\\My Extension Files\\LogAttrExtension"
  FileNames = slPacker.GetFileListFromFolder(FolderName)

  slPacker.Pack(FileNames, FolderName, FolderName + "\\LogAttrExtension.tcx")

VBScript

Sub PackFiles
  Dim FileNames, FolderName

  FolderName = "C:\My Extension Files\LogAttrExtension"
  FileNames = slPacker.GetFileListFromFolder(FolderName)

  Call slPacker.Pack(FileNames, FolderName, FolderName & "\LogAttrExtension.tcx")
End Sub

DelphiScript

procedure PackFiles;
var
  FileNames, FolderName;
begin
  FolderName := 'C:\My Extension Files\LogAttrExtension';
  FileNames := slPacker.GetFileListFromFolder(FolderName);
  slPacker.Pack(FileNames, FolderName, FolderName + '\LogAttrExtension.tcx');
end;

C++Script, C#Script

function PackFiles()
{
  var FolderName = "C:\\My Extension Files\\LogAttrExtension";
  var FileNames = slPacker["GetFileListFromFolder"](FolderName);

  slPacker["Pack"](FileNames, FolderName, FolderName + "\\LogAttrExtension.tcx");
}

After creating the .tcx file, you can install the extension into TestComplete and see how it works. For installation instructions, see Installing and Uninstalling Script Extensions.

Two notes:

  • The code created in this tutorial is part of the AQAScriptExtensions.tcx file that is included in TestComplete. You can find this file in the <TestComplete>\Bin\Extensions\ScriptExtensions folder.

  • The script extensions that are included into the AQAScriptExtensions.tcx file are installed in TestComplete by default. So, TestComplete already contains the Log Attributes operation.

    In order for the tutorial script extension to function properly, you need to disable the appropriate pre-installed extension in the Script Extensions dialog before installing your extension in TestComplete.

Prev

See Also

Script Extensions
Deploying Script Extensions
Installing and Uninstalling Script Extensions

Highlight search results