Units with worker classification will not attack automatically and will run off instead when attacked, and a idle worker icon will appear.
If you use attack and click it on the ground, the units will engage anyone automatically while moving to that area. That should include units with worker classification I think.