Forum Discussion
8 Replies
- Marsha_R
Champion Level 3
Look for a "text" or "value" or similar property of that message box and it will contain the message text. Compare that to what you expect it to be.
aqString methods can be helpful when working with strings.
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/methods.html
- IamvinodOccasional Contributor
Expected = "Attribute Level and Attribute Type must be selected"
Prop = "ContentText"
Set Obj = Sys.Browser().FindChild(PropName, PropValue ,30)
Actual = aqObject.GetPropertyValue(Obj, Prop)If Expected = Actual then
Log.message "Validation Passed"
Else
Log.message "Validation Failed"
End If
- msapFrequent Contributor
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")
- tristaanogreEsteemed Contributor
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')