This paper introduces a solution for designing a real-time flight tesing system based on Simulink and C++ mixed programming. The modules of aircraft are designed and tested in Simulink, and generated into C code separately by RTW toolbox, then applied into C++ project in Windows system, which is reasonably using the Windows timer with a minimums sample time at 2ms. This flight testing system can not only satisfy the real time require of the flight simulation of the AFCS, but also provide an easier way to design GUI and board card driver API. Based on this flight testing system, hardware in the loop(HIL) ground experiments have been made successfully with the AFCS, which helped the product to finalize in the future.