6.1.0: Repository.Item.TextValue returning false value

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Wed Oct 12, 2016 8:39 am

Hello,

I noticed a strange behavior in one of our test reports regarding the validation of a System.Windows.Forms.TextBox-element.
In a test-case we want to validate the displayed text of a TextBox-control after typing it in the control:
const int verzoegerungInMillisekunden = 100;

Report.Info("Suche", string.Format("Eingabe der Zeichenkette \"{0}\" in das Suchwert-Eingabefeld.", suchWertText));
suchWertEingabe.PressKeys(suchWertText);

Report.Info("Suche", string.Format("Test wird um {0} Millisekunden verzögert", verzoegerungInMillisekunden));
Delay.Milliseconds(verzoegerungInMillisekunden);

Validate.AreEqual(suchWertEingabe.TextValue, suchWertText, "Validierung des eingegebenen Textes - Soll: {1}, Ist: {0}");
To explain: Ranorex should press the key-sequence in the control, then wait for a short duration (when it first appears I thought of a timing problem) and finally validate the text displayed in the control.
suchWertEingabe: Repository item of the control
suchWertText: string to type, in this case "Taxiruf BC"
And the result was:
Report.png
I also attached the screenshots taken by Ranorex because of the false validation, where you can see that the text in the control is "Taxiruf BC" and not "Taxiruf".
How can we avoid this false validation failure?

Regards,
Thomas.
You do not have the required permissions to view the files attached to this post.

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

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by odklizec » Wed Oct 12, 2016 8:58 am

Hi,

If I understand your problem right, the expected validated text is "Taxiruf BC" but TextValue somehow returns just "Taxiruf"? I would suggest to add Report.Snapshot method just before the validation step so this way you could make sure what exactly is stored in the mentioned edit field at a time of validation.
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

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Wed Oct 12, 2016 10:17 am

Hello odklizec,

exact: TextValue didn't represent the real value.
Good idea: I will add a snapshot if validation fails because this code-snippet will be used multiple times while performing a test and I would get thousands of snapshots.
I'm curious about the result and hope it will give me a tip how to prevent this behavior.

Regards,
Thomas.

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Thu Oct 13, 2016 9:00 am

Hello,

yesterday the issue occurred again.
I changed my code to create a snapshot if validation fails:
const int verzoegerungInMillisekunden = 100;

Report.Info("Suche", string.Format("Eingabe der Zeichenkette \"{0}\" in das Suchwert-Eingabefeld.", suchWertText));
suchWertEingabe.PressKeys(suchWertText);

Report.Info("Suche", string.Format("Test wird um {0} Millisekunden verzögert", verzoegerungInMillisekunden));
Delay.Milliseconds(verzoegerungInMillisekunden);

try
{
    Validate.AreEqual(suchWertEingabe.TextValue, suchWertText, "Validierung des eingegebenen Textes - Soll: {1}, Ist: {0}");
}
catch (Ranorex.ValidationException ex)
{
    Report.Snapshot(ReportLevel.Failure, "Suche", "Suchwert-Eingabe", suchWertEingabe.Element);
    
    throw ex;
}
Report.png
But in the snapshot (attached to this post) the missing characters "#1" were included:
2016-10-13 09_52_35-Ranorex Spy (64bit) - Sonderzeichen_96_rxlog.rxsnp.png
I'm wondering how the TextValue lost those characters while validation?
And how can I prevent this behavior?

Regards,
Thomas
You do not have the required permissions to view the files attached to this post.

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

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by odklizec » Thu Oct 13, 2016 9:38 am

Hi,

That's really weird. Just for fun, could you please try to use Validate.Attribute instead of Validate.AreEqual, something like this?...

Code: Select all

Validate.Attribute(suchWertEingabe, "Text");
Eventually, instead of "Text" attribute, try to validate "AccessibleValue" attribute.
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

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Thu Oct 13, 2016 10:32 am

Hi,

it'll bring a lot of fun, I guess.
I added two lines in the "try"-block to see what will happen:
Validate.Attribute(suchWertEingabe, "Text", suchWertText, "Validierung des Attributs \"{1}\" von Element \"{0}\" - Soll: \"{3}\", Ist: \"{2}\"");
Validate.Attribute(suchWertEingabe, "AccessibleValue", suchWertText, "Validierung des Attributs \"{1}\" von Element \"{0}\" - Soll: \"{3}\", Ist: \"{2}\"");
I'll post the result if the issue happens again.

Regards,
Thomas.

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Mon Nov 28, 2016 8:44 am

Hello,

after a lot of tests the issue occurred once again.
Looks like a timing problem, maybe? After creating the snapshot the values and attributes were fine.

Report
Report.png
Code
var eingabeWertText = new string[3];
var zaehler = 0;
var istAnzeigeWertKorrekt = true;

//Prüfen, ob Suchfeld-Anzeige korrekt ist
eingabeWertText[0] = suchWertEingabe.Element.GetAttributeValueText("AccessibleValue");
eingabeWertText[1] = suchWertEingabe.Element.GetAttributeValueText("Text");
eingabeWertText[2] = suchWertEingabe.TextValue;

foreach (var wertText in eingabeWertText)
    if (!wertText.Equals(suchWertText))
        istAnzeigeWertKorrekt = false;

if (!istAnzeigeWertKorrekt)
    foreach (var wertText in eingabeWertText)
        Report.Warn("Suche", string.Format("Attribut/Wert {0}: \"{1}\"", ++zaehler, wertText));
You do not have the required permissions to view the files attached to this post.

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

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by odklizec » Mon Nov 28, 2016 9:22 am

Hi,

It definitely looks like a timing problem. It must be something in the tested app. Do you see if the text increments in GUI (in realtime)? You will either have to add a hardcoded delay value (which may not help in certain cases) or you will have to find an element (progress status), based of which you can tell the GUI is fully loaded and using WaitForExists/NotExists should help you with necessary delay.
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

BCTest
Posts: 127
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: 6.1.0: Repository.Item.TextValue returning false value

Post by BCTest » Mon Nov 28, 2016 3:27 pm

odklizec wrote:Hi,

It definitely looks like a timing problem. It must be something in the tested app. Do you see if the text increments in GUI (in realtime)?
Hi odklizec,

yes, you could be right. Typing in a character starts a search if no other character is typed in after a short time. Normally the system under test is quick enough to process the input in 500 milliseconds but it looks like it sometimes could last longer. This could explain the missing characters in the report. Ranorex has fill in the whole string but the app is still processing the input. I'll check my test and add a delay if the text is not fully displayed.

Thanks,
Thomas.