Forum Discussion
martin:
Could you please give some suggestions for validation messages comparision.
I have written below:
xtraMessageBoxForm.Click(126, 12);
Expected="Some errors occurred during validation"
//PropArray= new Arry("WndCaption","Error")
PropName ="ContentText"
Prop="WndCaption"
PropValue="Some errors occurred during validation"
Obj = Aliases.Framework.ExcelImportForm.grid.FindChild(PropName,PropValue,30)
Actual=aqObject.GetPropertyValue(Obj,Prop)
If(Expected == Actual)
Log.message("Validation Passed")
Else
Log.message("Validation Failed")
Well, I would throw out the code you have. It really doesn't do what you think it does. Here's what I read:
1) Take a piece of text
2) Go find an object that contains that piece of text
3) Compare the piece of text to the text contained in the object
Basically, you are finding an apple by looking for apples and then making sure it's an apple.
I would simplify it down to identifying the object by some value OTHER than the error text you're looking for. No, don't ask me what properties to use... I don't know your application or your object. Just look for the object first using some generic parameters that identify the object.
Then simply do something like
EDIT: I looked at your screenshot and it looks like a straight forward window. So...
Obj = Aliases.Framework.ExcelImportForm.grid.FindChild('WndCaption', 'Error',30)
if (Obj.contentText != 'Some errors occurred during validation')
Log.Error('Validation Failed')
else Log.Message('Validation Passed')
- msap8 years agoFrequent Contributor
Thanks Martin! I used message instead of contenttext as we are using desktop testing not web.
Obj = Aliases.Framework.FindChild('WndCaption', 'Error',30)
if (Obj.Message == "Some errors occurred during validation.")Log.Message('Validation Passed')
else
Log.Error('Validation Failed')It goes to else instead should display validation passed.
when I check the add watch button : it has properties including "Text and olevalue= Some errors occurred during validation.
could you please suggest.
- tristaanogre8 years agoEsteemed Contributor
Your original post indicated that you were using, in your code, contentText. I simply continued with that. Please maintain consistency. It helps me help you better.
All that means is that Obj.Message doesn't equal the desired value. So, you just need to replace that property in your If statement with the property that contains the desired text.
- msap8 years agoFrequent Contributor
I already tried Text .It doesnot work.I am not sure what other properies work here to work.Trying for other properties..