Failure on Expcted Value = '(null)', Actual Value = '(null)'

Ranorex Spy, Recorder, and Studio.
Bey
Posts: 3
Joined: Thu Oct 21, 2010 6:11 pm

Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Bey » Thu Oct 21, 2010 6:40 pm

I am a novice. Just started using Ranorex.
I recorded a very short VB6 session involving a login form.
As one of the first steps, I placed a validation on the LoginID text box to verify it is blank.
The step failed indicating that the expected value is '' but the actual value is '(null)'
So, i edited the Properties, saved and replayed.
Step failed again but, this time indicating that the actual value is the expected value - as shown below:

Replay (item #6) could not be completed because Attribute 'Text' of element for item 'FormGIFTS_Login.TextText1' does not match the specified value (actual='(null)', expected='(null)').

So, how does one specify a generic "blank" validation on the text element of the textbox object that will succeed if the length of the object is 0 (regardless of whether it is null or empty string)?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Support Team » Fri Oct 22, 2010 1:02 pm

Hi,

To validate the string of a text box, just but the string into the recording action. In you case you want to check if the text-box is empty. Therefore just delete the string and leave it empty. Then Ranorex should be able to check the empty string. The null keyword at the moment is not supported. This keyword will be available in a future release for Ranorex.

Regards,
Peter
Ranorex Team
.
Image

Bey
Posts: 3
Joined: Thu Oct 21, 2010 6:11 pm

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Bey » Sun Oct 24, 2010 4:19 am

Thanks Peter,

I guess i was not clear enough.

What i am reporting is that initially, i just took the default which was blank (nothing, nada, zilch, zippo - there were no characters in the value of the attribute shown by Ranorex in Properties)
But Ranorex's report indicated that the actual value of '(null)' does not match the expected value of "".
None of this was what i entered (i did not enter "", nor did i enter '(null)') this was all Ranorex' hallucination.
Only after noticing the results, i thought to myself (being a novice) that Ranorex is looking for '(null)' - a string with special / reserved semantics - when the field is blank - which, obviously, did not work either.

Before responding to my report, did you actually try validating a VB6 application's empty text box?
If so, did it work?
If it did work for you, how do you explain the difference between verification of my VB6 text box (which is most likely an Infragistics control - which Ranorex reportedly supports) and verification of your VB6 application's control?

Much appreciated

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Support Team » Mon Oct 25, 2010 9:59 am

Hi,

I tried a VB6 application and validated an empty text box. It was working as expected, but I don't have access to an Infragistics VB6 application. Maybe there is a difference between Infragistic and Microsoft in the control implementation for VB6. Would it be possible to post us a Ranorex Snapshot from your control? Or even better would be a sample application with this control.
How to create a snapshot:
http://www.ranorex.com/support/user-gui ... html#c2072

Attached the VB6 application.
Project1.zip
Application
(2.11 KiB) Downloaded 225 times
Regards,
Peter
Ranorex Team
.
Image

Bey
Posts: 3
Joined: Thu Oct 21, 2010 6:11 pm

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Bey » Thu Nov 11, 2010 12:17 am

Peter,
As it turns out, this is not unique to VB6 at all.
I just happened to notice it first there.
This was also noticed by Christoph (during a web session I had with him).
Until this is fixed (rrx 3.0?) ... I would like to write a few lines of code that enable me to verify that the length of text is 0 (instead of bothering to find out whether it is null or an empty string).

As i am a novice, i am not sure where this method should be - my preference is in some library common to all my projects as this, indeed, should be common - and should be called from the UserCode section of my project.

Much appreciated

Bey

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Support Team » Thu Nov 11, 2010 11:26 am

Hi,

With the upcoming release Ranorex 2.3.5 there will be a functionality in the RxPath that allows you a comparison with null values. Then it should be possible to execute you validate step.

Regards,
Peter
Ranorex Team
.
Image

Craig
Posts: 9
Joined: Thu Nov 04, 2010 8:43 pm

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Craig » Thu Jan 06, 2011 9:37 pm

Can you please show me a sample of how I can compare against null? I've looked through the documentation and I'm not seeing anything on this topic.

In my particular case, I have a DataGridCell whose TextBox is null. I imagined that I could create a validation item in my Ranorex recording and literally set its expected value to '(null)' but that doesn't work; I get the same error as the original poster. Do I need to write a user code method to do the comparison? Is there another approach I'm supposed to use? (And yes, I'm using Ranorex 2.3.6).

Please help,

-Craig

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Support Team » Fri Jan 07, 2011 2:12 pm

There are two ways how you can check if a value is null:
  1. You can use the "(null)" function in RanoreXPath (introduced with version 2.3.5) and check for the existence of an element with that path. For your example, you have to edit the RanoreXPath for the Cell and add an attribute comparison for its text: "[@text=null()]". Then you can use the "Validate Exists" action in the Ranorex Recorder on this item. The validation will only succeed if the cell can be found and its text is null. You can find an example for the RanoreXPath "null()" function here in the Ranorex User Guide.
  2. You create a user code item and call Validate.Attribute on the corresponding repository item info object:
    Validate.Attribute(repo.MyCellInfo, "Text", null);
    Just replace "Text" with the name of the attribute that needs to be null.
Craig wrote: I imagined that I could create a validation item in my Ranorex recording and literally set its expected value to '(null)' but that doesn't work
The problem is that the recorder cannot decide whether the specified attribute should have the string value "(null)" or the special value null. It always assumes the value is a string. The validation message looks a bit weird, because the special value null gets converted to the string value "(null)" just for being displayable.
Craig wrote:(And yes, I'm using Ranorex 2.3.6)
You might consider updating to Ranorex 2.3.7 which has recently been released :D

Regards,
Alex
Ranorex Team
.
Image

keystone520
Posts: 1
Joined: Tue Feb 07, 2012 5:32 pm

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by keystone520 » Mon Feb 27, 2012 11:31 pm

I am also new to Ranorex and utilizing it's User Code functionality.
I am getting this same failure when I validate that there is no value in an input box on a web page. I converted the validation to User Code and currently have:

Validate.Attribute(repo.WebDocumentLogin.SomeBodyTag.InputTagPwInfo, "Value", null);

This seems to be exactly what was suggested above in the second option, but I still get a failure stating:
"Value cannot be null. Parameter name: regex"

Ranorex is automatically selecting the Attribute(RepoItemInfo itemInfo, string name, Regex regex) method. I can't seem to figure out what I need to do to validate that the value of this input box is null.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by Support Team » Tue Feb 28, 2012 4:15 pm

keystone520 wrote:Ranorex is automatically selecting the Attribute(RepoItemInfo itemInfo, string name, Regex regex) method. I can't seem to figure out what I need to do to validate that the value of this input box is null.
You need to instruct the compiler to use the correct method, e.g. like this:
object value = null;
Validate.Attribute(repo.WebDocumentLogin.SomeBodyTag.InputTagPwInfo, "Value", value);
That way the compiler will not use the overload expecting a Regex.

Regards,
Alex
Ranorex Team
.
Image

mojohlic
Posts: 31
Joined: Thu Oct 11, 2012 4:37 pm

Re: Failure on Expcted Value = '(null)', Actual Value = '(null)'

Post by mojohlic » Fri Sep 13, 2013 4:09 pm

Alex,

That worked for me thanks. :D