stepper motor+encoder+arduino

I want to check that my stepper motor respects the setpoint (number of steps) is it necessary to add an encoder to my stepper ?

if yes, could you help me with the program

If the right stepper motor and driver are chosen for the job, steps will not be missed so the encoder is not required.