The word attack in magic is very, very specific to a creature being an attacker in the combat step. Any other source of damage is not attacking, be it fight, tap to deal damage, or any other less common effect.
For the purpose of "whenever a creature attacks" it's even more restricted, there are effects that create creatures already attacking, like Hero of Bladehold, these tokens created "tapped and attacking" were never declared as attackers, so they get by the restrictions from things like Crawlspace and do not trigger things like Revenge of Ravens.
This trigger is talked about in the comprehensive rules:
508.3a An ability that reads “Whenever [a creature] attacks, . . .” triggers if that creature is declared as an attacker. Similarly, “Whenever [a creature] attacks [a player or planeswalker], . . .” triggers if that creature is declared as an attacker attacking that player or planeswalker. Such abilities won’t trigger if a creature is put onto the battlefield attacking.