Can I damage my brakes by testing them vigorously? My understanding is that it’s important to regularly test one’s brakes, by grabbing the lever and squeezing it hard, perhaps all the way down to the bars. The theory is that if they’re going to fail, it’s far better that they do so on the workstand than during a panic stop.

My question: does this testing itself cause wear or damage? And if so, how can I mitigate or compensate for it?

To clarify: This test is designed to see if anything is broken, not tightened sufficiently, etc., rather than “do the brakes stop the bike”. For example, this weekend I discovered that the cable had worn down over a corner [aside: I have an appointment to re-route the cable] by breaking it during this test.
As others have noted, your brakes probably aren't set up correctly if you can squeeze the lever so far that it touches the bar while the bike is stationary. That said, squeezing the brake levers while the bike is on a stand won't cause any more wear than normal braking would [1].

If you want to determine how hard to squeeze the brakes while on the stand, a good test is this: ride at a moderate speed in a safe environment and then try to rapidly stop.  Your brake levers should not touch the bars, and (obviously) nothing should break loose.  A properly adjusted rear brake should be able to skid the rear wheel (but it is considered poor braking technique to skid the rear wheel).  A properly adjusted front brake should should be able to lift the rear wheel off the ground (you don't want to actually lift it, so use care).  Try to get a feel for how much pressure you apply to the levers when you practice a panic stop and then apply a little more when the bike is on a stand.

Please note that it is unsafe to suddenly fully-apply the brakes (suddenly squeeze both levers as hard as you can) while traveling at speed.  If your brakes are properly adjusted, you should be able to easily lock either wheel by pulling hard on the brake lever.  

For the rear wheel this is less of a problem: You will simply skid the wheel, wearing down the tire.  If you do this enough, or at a high enough speed or with a thin road tire, you risk wearing down the rubber to the innertube.  If that happens, the tire will rapidly deflate and you will be riding on the rim (this is bad).  

Locking the front wheel is a bigger problem: the front wheel will NOT skid. If you lock the front wheel, you will go over the bars and hurt yourself.

[1] Within reason, of course.  If you're some sort of Olympic weightlifter, it's possible that you might squeeze hard enough to damage something.  Also, if the brakes are "looser" after you squeeze really hard (ie, if you have to pull the lever farther, not harder, to make the brake pads touch the rim) then you are either squeezing too hard, or you need to readjust the cable and tighten the cable clamp on the brake.