
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello,
I was wondering if it is possible to access an Activities's "CheckPoints" from within a C# Event Handler or a C# Custom Code Acitivity. The idea behind this would be to access an Activities "CheckPoints" to see if they passed or failed and take an action at that time.
-Craig
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi
Here is a simple code to evaluate the checkpoint in runtime, similar as your example using Database activity:
public void DbFetchData6_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
{
args.Checkpoint.RunUICheckpoints = true;
// Get a collection of xml elements to extract the element with actual value we have the checkpoint set on
var actual = this.DbFetchData6.OutputProperties.DocumentElement.GetElementsByTagName("Make").Item(0).InnerText;
var expected = "Nissan";
var chkResult = args.Checkpoint.Assert.Equals(actual, expected);
this.Context.UserLogger.Info("Checkpoint result :" + chkResult.ToString());
}
Output when pass
Step 'Select Data6' : Step 'Select Data6' started
CodeCheckpoint0: "Nissan" Equals "Nissan" passed
Checkpoint result :True
Output when fails
Step 'Select Data6' : Step 'Select Data6' started
CodeCheckpoint0: "Nissan" Equals "Dodge" failed
Checkpoint result :False
” If you find this or any post useful to resolve the issue, please mark this thread as correct answer and other members can benefit with the information given”
regards,
Fabio
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]
[Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Craig
You may be able to acomplish this by using the Checkpoint Object. This object is only accessible when using the OnCodeCheckpointEvent event. Let me provide an example using a simple concatenate string activity as follows:
public void ConcatenateStringsActivity4_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
{
args.Checkpoint.RunUICheckpoints = true;
if (args.Checkpoint.Assert.Equals(this.ConcatenateStringsActivity4.Result))
this.ConcatenateStringsActivity4.Report(ConcatenateStringsActivity4.Result, "Passed");
else
this.ConcatenateStringsActivity4.Report(ConcatenateStringsActivity4.Result, "Failed");
}
You may also find more information on the UFT help searching for topics like Checkpoint object and Assert Object.
Hope this helps.
regards.
-Fabio

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Fabio,
Thank you for the reply. I had actually tried what you mentioned but the "Result" always returns true, even if a checkpoint fails...
For now, I am simply just logging the result. here is the code I have:
public void DbFetchData8_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
{
args.Checkpoint.RunUICheckpoints = true;
this.Context.UserLogger.Info(this.DbFetchData8.Result);
}
Here is the info from the output log. You can see that the result returns true:
Step 'Iteration 2' : Step 'Iteration 2' started
Step 'Validate Test Data' : Step 'Validate Test Data' started
True
Checkpoint 0: "1" = "0" failed
Step 'Validate Test Data' ended successfully
Step 'Iteration 2' ended successfully

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
It appears that even though i have entered the:
args.Checkpoint.RunUICheckpoints = true;
that the check points arent being ran until after the code Event Handler is exected.
Any idea why this would be?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Craig
In fact the checkpoints are being evaluated on that event, problem is that there aren't object public members that we can access to actually get the checkpoint status.
this.DbFetchData8.Result is the result of the execution meaninf if the activity executed with success or not despite of the result of the checkpoint evaluation.
I'm doing some more investigation and seems only option for now is to use the Assert method to evaluate the actual and expected values and get the result from there.
Once a come up with some code I will posted here.
regards
Fabio

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi
Here is a simple code to evaluate the checkpoint in runtime, similar as your example using Database activity:
public void DbFetchData6_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
{
args.Checkpoint.RunUICheckpoints = true;
// Get a collection of xml elements to extract the element with actual value we have the checkpoint set on
var actual = this.DbFetchData6.OutputProperties.DocumentElement.GetElementsByTagName("Make").Item(0).InnerText;
var expected = "Nissan";
var chkResult = args.Checkpoint.Assert.Equals(actual, expected);
this.Context.UserLogger.Info("Checkpoint result :" + chkResult.ToString());
}
Output when pass
Step 'Select Data6' : Step 'Select Data6' started
CodeCheckpoint0: "Nissan" Equals "Nissan" passed
Checkpoint result :True
Output when fails
Step 'Select Data6' : Step 'Select Data6' started
CodeCheckpoint0: "Nissan" Equals "Dodge" failed
Checkpoint result :False
” If you find this or any post useful to resolve the issue, please mark this thread as correct answer and other members can benefit with the information given”
regards,
Fabio
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]
[Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Fablo,
Thank you for the info, it is greatly appreciatedQ This will allow me to do what i need to do for now. Do you know if there is an enhancement request for accessing the Checkpoints status's via object public members or if this is something that has been considered for future versions of UFT? Thanks again!
-Craig

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Craig
You are welcome and I don't think there is any ERs on this topic yet. I wourld recommend to open an enhancement request so it can be considered for future realease or patch.
regards
Fabio.