7. Creating Operation's Icon

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

Now, we can create an icon for our operation. This icon will be displayed next to the operation name in the operations palette and in tests.

The icon must be a 16×16 BMP or PNG file with the 24-bit or lower color depth. The color of the lowest left pixel is treated as the “transparent” color.

To create a bitmap or PNG, you can use any graphic editor, for example, MSPaint.

la-icon.bmp
la-icon.bmp
Right-click the image and select Copy from the context menu

You can copy the image from this topic:

  • Right-click the image on the right and select Copy from the context menu. This will copy the image to the clipboard.

  • Switch to a graphic editor and paste the copied image to it.

  • Save the image under the la-icon.bmp name to the C:\My Extensions\LogAttrExtension folder (that is, to the folder that contains the description.xml file).

Let’s add information about the icon to the description file. For this, we need to add the Icon attribute to the KDTOperation element corresponding to our custom operation and specifying the icon’s file name as the attribute value:

  • Open the C:\My Extension Files\LogAttrExtension\description.xml file in your text or XML editor.

  • Add the following text to it:

    XML

    [description.xml]

    <?xml version = "1.0" encoding = "UTF-8"?>
    <ScriptExtensionGroup>
      <Category Name = "Keyword Test Operations">
        <ScriptExtension Name = "Log Attributes Keyword Test Operation" Author = "SmartBear Software" Version = "1.0 test" HomePage = "smartbear.com">
          <Description>Provides the Log Attributes keyword test operation.</Description>
          <Script Name = "laCode.js">

            <KDTOperation Name = "Log Attributes" Category = "Logging" Icon = "la-icon.bmp">
              <Data>
                <!-- General properties -->
                <Field Name = "Description" />
                <!-- Log Attributes object properties -->
                <Field Name = "FontColor" />
                <Field Name = "BackColor" />
                <Field Name = "Bold" />
                <Field Name = "Italic" />
                <Field Name = "Underline" />
                <Field Name = "Strikeout" />
                <Field Name = "PlainTextRemarks" />
              </Data>
              <Events>
                <Event Name="OnCreate" Routine="LogAttr_OnCreate"/>
                <Event Name="OnExecute" Routine="LogAttr_OnExecute"/>
              </Events>
            </KDTOperation>

          </Script>
        </ScriptExtension>
      </Category>
    </ScriptExtensionGroup>

  • Save the changes.

Prev     Next

See Also

Script Extensions
Creating Keyword Test Operations - Basic Concepts

Highlight search results