DEV Community

Discussion on: Using "data-test" in Tests

Collapse
 
mikerogers0 profile image
Mike Rogers ✈️

I done this before, and it's really good way of targeting elements. That said, instead of data-test I just copied bootstraps approach to attributes (e.g. data-toggle="dropdown" & data-tatget="#something"), which seemed a bit more semantic.

Collapse
 
rstankov profile image
Radoslav Stankov

I like the bootstrap technique too. Used it in couple of times in the past. Don't do it recently, since most of browser work, I do is React now days.

What I like about data-test is the intent it reveals. This is for easier test targeting. Not implementation detail.