They know where they are hidden in every title.

In ETW, they just walk really slowly up to your hidden units if they are ranged and then run as soon as they get within your firing range, even if your units are not on fire at will. In that, the AI will make a point of going after your hidden units first in many cases.