There's a lot of testing, both in isolation and in integration with other components. The risk of the rocket exploding should actually reduce with each test. Note also that in this case the malfunction was most likely with the pad equipment, not the rocket, so not doing static fires would in this case probably just have meant that you'd have an explosion at launch time one day.
EDIT: The static fire is more of a test for launch procedures, apparently:
“The goal of the static fire is to provide a dress rehearsal for the launch team, culminating in a three second firing of all nine of the first stage Merlin 1D engines to validate the health of the rocket.” (https://www.nasaspaceflight.com/2016/09/falcon-9-explodes-am...)
Makes sense in that the rocket itself is tested quite a bit beforehand already.