Unique identifiers for ui automation

Our ui automation team asks for the best way to select items for their automated tests. I believe that we can introduce a special attribute (for example, "ui-auto") for each element being checked. This attribute will have a value that:

  • unique
  • persistent (does not change in sessions or page loads, so as not to break tests)
  • predictable (several naming conventions follow depending on the type of action, location, etc.)

My questions:

  • Is that a good idea? Best ideas are welcome.
  • Are there existing agreements for this?
  • What is the best way to implement this?

I should mention that we use angular, and I thought that using some kind of directive and / or service would help automate this.

I must also say that I do not want to use the id (id) b / c attribute. I would like to have a distinction between development issues (ids can be used for javascript) and qa (select items for automatic tests)

+4
source share
2 answers

In our implementation, we add the data-awt attribute to the DOM element, the value consists of the context type (page and mode) and a unique string. Since we use the EXTJS library, our type is the xtype type, and the unique string is the component name or text property. Context is developer-controlled by placing a unique property on top of the parent itself, and all children use this as their context.

data-awt, devicesListing-button-edit, deviceDetails-displayfield-name, deviceDetailsEditWindow-textfield-name.

, css, id , , . , (, PM , "" DTO).

+1

"auto_" "t_".

, - , .

@o4ohel , , , . . .

+1

All Articles