Model-in-the-Loop (MiL) testing is a method in which the test object is split into a physical part and a simulated part, and these are connected with interfaces to form a combined physical-numerical system. The challenge of generating a MiL test is that, firstly, because of the limited dynamic response of the actuators, the test results may be inaccurate, and secondly, because of the high frequency noise introduced by the sensors to the closed-loop system, it may be difficult to design a compensator for the actuator response, while stabilizing the closed-loop system at the same time. In this paper, a MiL system is designed using a small hydraulic robot arm. The problems with the MiL test without any compensator is shown with experimental results. The effectiveness of a 1st order phase lead compensator and an inverse model compensator are validated in the experiment. For systems which can be approximated by linear timeinvariant models, it is proposed that compensator design is a linear optimization problem balancing emulation error with noise amplification. Thus, a new method of designing the compensator for MiL testing based on H-∞ optimization is presented.