Optimize new web based portal for test automation

Ask general questions here.
Posts: 24
Joined: Tue Nov 04, 2014 3:13 pm

Optimize new web based portal for test automation

Post by nico » Mon Nov 24, 2014 1:46 pm

I was asked to take a look at a new project, in which a web based portal will be developed.
It should function in the recent versions of Internet Explorer.

Since it is still early in the development stage, we have the opportunity to add certain markers to optimize the object recognition for automated testing purposes.

I have never dealt with, a new project before and what opportunity it brings, so what tips should I give the development team to enhance the possibility for automating the tests.

Certain DOM objects that can be easily used and recognized by Ranorex (Spy)?
Using unique names for the objects?
Not creating custom objects?

Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Optimize new web based portal for test automation

Post by krstcs » Mon Nov 24, 2014 3:37 pm

For web projects, the single biggest thing that your devs can do to help you is to add the "id" attribute and make the value of that attribute be unique:

<input id='username_field'/>
<button id='okButton'>OK</button>

This will allow you to identify the elements very quickly and without trying to use values that might change at run-time (such as identifying the button by the innertext of 'OK', which might change to 'Yes'). This also helps for localizations where you have a different text string for different languages.

Also, they need to be unique for each object on the page. Two buttons should not have the same ID, even if they are both "OK" buttons. Make one "okButton1" and the other "okButton2".
Shortcuts usually aren't...