Based on the theory of probability and mathematical statistics, an optimized model of quality cost is propounded, and the solation of the model is derived. Therefore a definite principle of how to control quality cost by the testing method is acquired.