According to Tafsir Ibn Kathir, this verse was explicitly revealed in the context of the Battle of Uhud; in that sense it would be seen as a defensive battle as the Makkan army was at that time sent against the Muslims of Medina.
However, taken in context the emphasis is far less on any particular mode of fighting as it is on unity. The hypocrites who "…say what [they] do not do" are essentially being reprimanded for either failing to fulfill their promises to stand with the Prophet and fight, or for claiming that they had fought hard when they did not. In other words, for appearing to stand as one with the fighting forces when they in fact did not.
Even if the verse itself was explicitly revealed regarding Uhud, the general understanding can (and probably should) be extrapolated for not only any form of fighting, but for general unity of the Ummah itself. Whether it was an offensive or a defensive battle is irrelevant; fighting was commanded, and those who believed (or claimed to believe) that the Prophet spoke with the authority of God should've been committed to following through on that, but for whatever reason (be it weakness of faith, fear of worldly harm or outright malice) many weren't.