What is a simple method for measuring the physical vibration of a step motor (to STM32) in order to take it to a minimum?
What you are being asked to investigate is the settling time (impacted by mechanical resonances in the stepper) for steps. 

I suggest you read section 4.3 of Stepper motors: A guide to theory and practice. It's somewhat older but has an excellent coverage of the topic. 

What you are looking for is a way to measure the settling time (you should think about this once you understand) for the various steps. 
The worst resonance is when full stepping and it gets progressively less as you increase the micro-stepping ratio. There are downsides to micro-stepping of course and loss of step torque is the most apparent.



For full and half steps you can use viscous and magnetic dampers to reduce the oscillation, but micro-stepping is far superior if you can tolerate the torque dropoff. 

To see this applied you could start with the Trinamic Motion Control paper on using a micro-step motor for linear arm positioning. They give a good explanation of the algorithmic processes used to achieve very low resonance in a linear tone arm.