cancel
Showing results for 
Search instead for 
Did you mean: 

Using checpoint is it possible to display customized message in result/logs

SOLVED
Highlighted
Visitor

Using checpoint is it possible to display customized message in result/logs

Whenever a checkpoint is used in script it always displays the standard message in TestComplete logs .

 

aqObject.CheckProperty(Object, "Enabled", cmpEqual, True)

Result:The property checkpoint passed: Enabled equals True.

 

When using checkpoint Is it possible to Customize the message shown in logs?

 

 

Test Analyst
1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Using checpoint is it possible to display customized message in result/logs

Not using that as it is.

 

What you can do is, instead, use aqObject.Compare property.  This returns a boolean true/false which you can use to drive further code.  It also supports a "MessageType" parameter which you can set to "none" to supporess automatic messages.  Then, what you can do, if the result returns true, use a Log.Checkpoint call to log your own custom message and, if the result returns false, use Log.WArning or Log.Error to log your own custom message.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
3 REPLIES 3
Community Hero

Re: Using checpoint is it possible to display customized message in result/logs

Not using that as it is.

 

What you can do is, instead, use aqObject.Compare property.  This returns a boolean true/false which you can use to drive further code.  It also supports a "MessageType" parameter which you can set to "none" to supporess automatic messages.  Then, what you can do, if the result returns true, use a Log.Checkpoint call to log your own custom message and, if the result returns false, use Log.WArning or Log.Error to log your own custom message.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Super Contributor

Re: Using checpoint is it possible to display customized message in result/logs

I was looking to log a common screen name from the alias of the object as an example of a custom message. So if there is a pattern of how you want to customize, you may be able to do something similar. In the following example, I take the LogParams of the checkpoint event, strip out the object name then do a lookup to a table of Alias to common, human readable name.

 

I don't know if this example is useful.

 

 

function GeneralEvents_OnLogCheckpoint(Sender, LogParams)
{  		 

	var objectName = GetObjectName(LogParams.AdditionalText);
	LogParams.MessageText = LookUpObjectinProject(objectName) + LogParams.MessageText;
	
}

 

// String maniulation to get the object name of the mapped name
// RETURN that object name string.
function GetObjectName(additionalText)
{
  	// String manipulation gets the name of the object objectName
	var intPosOne = additionalText.indexOf("<td>") + 4;
	var intPosTwo = additionalText.indexOf("</a>");

	var objectName = additionalText.substring(intPosOne, intPosTwo);
	
	intPosOne = objectName.indexOf(">") + 1;
	objectName = objectName.substring(intPosOne);
	// string manipulation to get objectName compelte
	
	return objectName;
}
// Take name input parameter and look for a common name in the PROJECT VARIABLE that
// has a 2 column table of object names and their corresponding common human understandable, name.
// If a common name exists, return it, else an empty string is returned.
function LookUpObjectinProject(objectName)
{

	var commonName =  "";
	// get common name lookup table
	if (Project.Variables.VariableExists("ScreenObjectCommomName"))  // if the table does not exist, do no translation
	{
		var t = Project.Variables.ScreenObjectCommomName;
		var iterator = t.Iterator;
		iterator.Reset();
		while (!iterator.IsEOF())
		{
			if (iterator.Value(0) == objectName)
			{
				commonName = iterator.Value(1) + " ";
				break;		
			}
			iterator.Next();
		}
	
	}  
	return commonName;
  
}

 

Community Manager

Re: Using checpoint is it possible to display customized message in result/logs

Thanks for sharing your suggestions, tristaanogre, vthomeschoolm!

 

@vprabhubalu, did these suggestions help you find an answer to your question? Please share your solution with us.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors