Validation fail despite it looking successful to me.

Ask general questions here.
sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Validation fail despite it looking successful to me.

Post by sstowe » Tue Jun 26, 2018 1:28 pm

I have the following user code to perform validation:

Code: Select all

        public void Validate_PaymentTotal(RepoItemInfo h1tagInfo)
        {
        	
        	Decimal number = Convert.ToDecimal(PaymentAmount);
        	string paymentTotal = "Payment Total " + String.Format("{0:n}", number);
        	
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (InnerText=$PaymentAmount) on item 'h1tagInfo'.", h1tagInfo);
            Validate.AttributeEqual(h1tagInfo, "InnerText", paymentTotal);
        }
A user may enter a numeric value in an <input> The app appends ".00" to the H3 text that I am trying to validate when a user does not input it. This validation fails. See attached log screen shot.
Attachments
ValicationFailure.png
ValicationFailure.png (26.12 KiB) Viewed 102 times

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

Re: Validation fail despite it looking successful to me.

Post by odklizec » Tue Jun 26, 2018 1:32 pm

Hi,

There appears to be a space after 'actual' Payment Total 1.00. Just examine the report closely ;)
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

sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Re: Validation fail despite it looking successful to me.

Post by sstowe » Tue Jun 26, 2018 2:09 pm

Don't I feel like an idiot. Off to get more coffee. Thanks.

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

Re: Validation fail despite it looking successful to me.

Post by odklizec » Tue Jun 26, 2018 2:12 pm

Don't be so hard to yourself. It happens to me frequently ;)
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

sstowe
Posts: 62
Joined: Thu May 31, 2018 2:26 pm

Re: Validation fail despite it looking successful to me.

Post by sstowe » Tue Jun 26, 2018 2:18 pm

:D