cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing 2 equal values failed in property checkpoint

SOLVED
Highlighted
Contributor

Comparing 2 equal values failed in property checkpoint

Hi,I try to compare property in checkpoint, the property compare failed although it has same valueCapture.JPG

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: Comparing 2 equal values failed in property checkpoint

You can write a script routine using the script editor of TestComplete.  You should have chosen a script language when you created your project.

 

Once your script code is written, you can use the "Run Script Routine" operation to execute the code within your keyword test.


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
Community Hero

Re: Comparing 2 equal values failed in property checkpoint

Hi,

 

> The value is float

This is the key. Regular comparison logic does not work with floats due to their internal representation. Your approach with the threshold is valid and generally used one.

 

Or, convert floats to strings as it was suggested by Robert and do strings comparison.

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
8 REPLIES 8
Community Hero

Re: Comparing 2 equal values failed in property checkpoint

Non-printing characters, spaces, etc., all are compared.  If you're comparing string to string, it needs to be EXACT.

Double check to make sure that the actual property does not have spaces at the end.  You could always change the test to "contains" instead of "equals".


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
Contributor

Re: Comparing 2 equal values failed in property checkpoint

Hi Trisyaanogre,

The values are exactly the same, no spaces or something like that, even when I updated the property to the actual value and ran the test again it fails.

Furthermore the value is recognized as a number and not as a string (I don't have the "contains" condition) .

My end game is to compare the value with  a threshold - is there any way to do this? 

 

Community Hero

Re: Comparing 2 equal values failed in property checkpoint

I'm wondering if it may be a rounding problem... that the property value actually contains more significant digits than what is visible... or if it's a data type problem (double vs long).

What would happen if you had your "Expected Value" stored as a string?  To see if it compares string to string?


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
Contributor

Re: Comparing 2 equal values failed in property checkpoint

The value is float, the main goal of this test is to compare array of floats.

I can not change the type of the property because it is an external component.

 

Is there a way to compare array of values and not only one?

Community Hero

Re: Comparing 2 equal values failed in property checkpoint

I would write script code for that rather than using a property checkpoint.


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
Contributor

Re: Comparing 2 equal values failed in property checkpoint

How do I replace checkpoint with script code?

Community Hero

Re: Comparing 2 equal values failed in property checkpoint

You can write a script routine using the script editor of TestComplete.  You should have chosen a script language when you created your project.

 

Once your script code is written, you can use the "Run Script Routine" operation to execute the code within your keyword test.


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
Community Hero

Re: Comparing 2 equal values failed in property checkpoint

Hi,

 

> The value is float

This is the key. Regular comparison logic does not work with floats due to their internal representation. Your approach with the threshold is valid and generally used one.

 

Or, convert floats to strings as it was suggested by Robert and do strings comparison.

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video: