Validation 'AreEqual' - user code

Best practices, code snippets for common functionality, examples, and guidelines.
martin_n
Posts: 1
Joined: Tue Jan 17, 2017 10:13 am
Location: Bratislava, Slovakia

Validation 'AreEqual' - user code

Post by martin_n » Mon Jan 30, 2017 12:43 pm

Hello,

could you please explain me, how to modify the parameter, which an object form repository is compared to? I am trying to validate a KeePass version using user code:

Code: Select all

string strKeePassVersion = "2.34";

Validate.AreEqual(MyRepo.AboutForm.KeePassVersion, strKeePassVersion);
When the test case is running, this validation fails, giving the following report:

Module execution was aborted because a validation step has failed. Objects are not equal (actual='{Cell:2.34}', expected='2.34').

I believe there must be something smarter than assigning the exact value {Cell:2.34} to that string variable. Is there a method, which would return the text value of that cell only? Or should I modify the Xpath of that element?

I am using Ranorex 6.2.0 on Win7 Prof, SP1, 64bit


Best regards,

Martin

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validation 'AreEqual' - user code

Post by odklizec » Wed Feb 01, 2017 8:42 am

Nazdar ;)

Just use Validate.Attribute instead of Validate.AreEqual, like this...

Code: Select all

Validate.Attribute(MyRepo.AboutForm.KeePassVersion, "Text", strKeePassVersion);
Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration