This is pretty standard stuff, its called measuring the step response of a system and it applies to anything, from compressors, eq's, etc... and you could do the same thing with a digital scope thou... square waves have extremely fast rise and decay times (what you are actually measuring is its step response to a positive and negative pulse), so even though you might be accurately measuring the compressor response to a step input, when it comes to music, signals usually don't have such fast transition times. If you use a band limited square wave, this will soften the transition edges and give a more "musical" representation of how compressors work on music signals. You could also use other type of signals, like a sine wave with a gaussian envelope (a sinewave multiplied by something like a Hanning window) also know as a wave packet, etc...