Missed ranorex operations. Defensive coding strategy?
Posted: Thu Apr 08, 2010 2:52 pm
Hello,
In the context of a webdocument, I had the following in a method to set and inputtag (i.e. text box on the webpage).
.....
m_WebDoc.WaitForDocumentLoaded(); //the patient seclector web page.
Ranorex.InputTag patientInputText = repo.WebDocSelectPatient.inputxtPatientName;
patientInputText.TagValue = searchText;
I noticed that SPORADICALLY, the Input text box is simply not set (no error is thrown). Later my script failes down stream. (I even tried using Innerhtml instead of Tagvalue... ). Now I have added a tryfind single on 'inputPatientName' before setting it. Hasn't failed yet.
So in general :What is a defensive coding stragety? In the above case, after setting the tagValue should I add a check to get the InputTag's value and explicitly check if it was really set (if not thow an error / exception....)?
I have couple of sporadic issues like the above... were Ranorex attempts an 'operation' on a widget but dosen't actually perform it. (no excetion raised either).
One thought to improve stability is to explicity check after the 'operation'. Like say I check a checkbox, then next line I check ... was it really checked?. I set a text field, next line I check if it was really set?....
But flip side, wrapping every single operation (sets, clicks etc) with an assert / conditional check?. There will be too many of them. So appreciate if any of you can shed light on some best practices here.
In the context of a webdocument, I had the following in a method to set and inputtag (i.e. text box on the webpage).
.....
m_WebDoc.WaitForDocumentLoaded(); //the patient seclector web page.
Ranorex.InputTag patientInputText = repo.WebDocSelectPatient.inputxtPatientName;
patientInputText.TagValue = searchText;
I noticed that SPORADICALLY, the Input text box is simply not set (no error is thrown). Later my script failes down stream. (I even tried using Innerhtml instead of Tagvalue... ). Now I have added a tryfind single on 'inputPatientName' before setting it. Hasn't failed yet.
So in general :What is a defensive coding stragety? In the above case, after setting the tagValue should I add a check to get the InputTag's value and explicitly check if it was really set (if not thow an error / exception....)?
I have couple of sporadic issues like the above... were Ranorex attempts an 'operation' on a widget but dosen't actually perform it. (no excetion raised either).
One thought to improve stability is to explicity check after the 'operation'. Like say I check a checkbox, then next line I check ... was it really checked?. I set a text field, next line I check if it was really set?....
But flip side, wrapping every single operation (sets, clicks etc) with an assert / conditional check?. There will be too many of them. So appreciate if any of you can shed light on some best practices here.