measure rpm of stepper motor

I'm told to do the programme by using any one encoder on the moving motor.The thing is the motor is moving and the rpm of the motor needs to be automatically updated without any person holding it each time.