If the data is hard coded
<th data-test="foo">
If the value has code
<th [attr.data-test]="'foo-' + data.bar"
Here data
is an object available to the code (as props) from which you extract the value of the key bar
and add it to the static text foo-
you will need for the componnet to support this.