Software testing is one of the important means to ensure the quality of automotive software, and the completeness of the test case set is a key factor in software testing. This paper proposes a method for generating software test cases based on state diagram, it using the state chart and extended finite state machine to construct the test graph and study the test coverage path, the test case collection of the test coverage criterion can be obtained. The method can be used for unit testing and integration testing in the automotive software testing process, and the efficiency and accuracy of the method are verified by the test cases of actual automotive software.