Originally posted by scot1967 on January 03, 2025
I use the test name as my main description but I also wrap tests within Log.AppendFolder(“My Description”) and Log.PopLogFolder(). I am not sure why the ‘Description’ field in the Execution Plan does not provide this feature. SmartBear?
https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log/methods.html
I have also used script to change the fonts for the messages using the LogAttributes Object.
https://support.smartbear.com/testcomplete/docs/reference/project-objects/test-log/log-attributes/index.html
Here is some code for various attribute changes you can make.
/*#################### Class Attributes ################
Class Name: Attributes
Description: Contains methods to format Log messages.
Arguments: None
Methods Return: attr object
#########################################################*/
class Attributes
{
/*#################### Method CorrectRGBComponent ################
Method Name: CorrectRGBComponent
Description: Accepts a component value converts it to an integer and ensures it is >= 0 and <= 255
Arguments: a single component value
Methods Return: integer representing an RGB color component between 0-255.
#########################################################*/
static correctRGBComponent(component)
{
try
{
component = aqConvert.VarToInt(component);
if (component < 0)
component = 0;
else
if (component > 255)
component = 255;
return component;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*###################### Method rgb #####################
Method Name: rgb
Description: Accepts rgb values and returns color
Arguments: r, g, b component values
Methods Return: color value
#########################################################*/
static rgb(r, g, b)
{
try
{
r = this.correctRGBComponent(r);
g = this.correctRGBComponent(g);
b = this.correctRGBComponent(b);
return r | (g << 8) | (b << 16);
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method TestCaseFolder ###############
Method Name: TestCaseFolder
Description: Returns attributes used for a Test Case Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static caseFolder()
{
try
{
let attr = Log.CreateNewAttributes();
attr.FontColor = this.rgb(1,1,1);
attr.BackColor = this.rgb(199, 207, 219);
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method StepFolder ###############
Method Name: StepFolder
Description: Returns attributes used for a Step Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static stepFolder()
{
try
{
let attr = Log.CreateNewAttributes();
attr.FontColor = this.rgb(1,1,1);
attr.BackColor = this.rgb(230, 231, 237);
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method LogFolder ###############
Method Name: LogFolder
Description: Returns attributes used for a Log Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static logFolder()
{
try
{
let attr = Log.CreateNewAttributes();
attr.FontColor = this.rgb(1,1,1);
attr.BackColor = this.rgb(230, 231, 237);
attr.Bold = false;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method GreenComment ###############
Method Name: LogFolder
Description: Returns attributes used for a Log Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static greenComment()
{
try
{
let attr = Log.CreateNewAttributes();
attr.BackColor = clGreen;
attr.FontColor = this.rgb(1,1,1); //clBlack and rgb(0,0,0) changes to white with Dark mode...
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method yellowComment ###############
Method Name: LogFolder
Description: Returns attributes used for a Log Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static yellowComment()
{
try
{
let attr = Log.CreateNewAttributes();
attr.BackColor = clYellow;
attr.FontColor = this.rgb(1,1,1); //clBlack and rgb(0,0,0) changes to white with Dark mode...
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method redComment ###############
Method Name: redComment
Description: Returns attributes used for a Log Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static redComment()
{
try
{
let attr = Log.CreateNewAttributes();
attr.BackColor = clRed;
attr.FontColor = this.rgb(1,1,1); //clBlack and rgb(0,0,0) changes to white with Dark mode...
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
/*################# Method boldFont ###############
Method Name: boldFont
Description: Returns attributes used for a Log Folder
Arguments: None
Methods Return: attributre object
#########################################################*/
static boldFont()
{
try
{
let attr = Log.CreateNewAttributes();
attr.Bold = true;
return attr;
}
catch(err)
{
Log.Error("Exception: "+err.message);
}
}
}
module.exports.Attributes = Attributes;