My question is that how do you determine if a nation suffering from e.g. civil war, external attack or any political or economic crisis is actually under the punishment of Allah or the test of Allah (swt)?
We cannot determine with absolute certainty that whether a nation is under wrath of God is being tested. It is only after the clear warning of a Messenger of God to a nation that when they reject the Messenger and his message and they are punished that we can be sure that it is a divine punishment. For a detailed study of the sunnat allah regarding the Messengers and their addressees please refer to: Playing God: Misreading a Divine Practice