Although the safety-critical system has high demand on safety, the cost of software test therefore must be taken account of. In the test of railway computer interlocking software carried out, the safety test for a station software last several months, therefore, in order to reduce the test time, it is practical to choose functions from the function set to test through optimization. Software safety test is realized by running testing cases at the cost of labor and time. It is expected to detect dangerous function defects and reduce system loss to gain benefit. Optimization strategy is a best choice to consider testing cases.