Test case automatic generation and management in Test-Driven development are studied, and the existing solutions to which are compared. A solution based on formal method to generate and manage test cases is put forward. Through formal language describing software contract and corresponding tools generating and managing test cases, this solution can improve the efficiency of Test-Driven development. Finally, this solution's applicati...