The invention discloses a hardware-in-the-loop automatic test method and
system, and the method comprises the steps: receiving a technical
specification document and a historical failure case
library of a tested device, analyzing a technical specification through a
natural language processing model to extract key test parameters, carrying out the
correlation analysis of the key test parameters and a fault mode in the historical failure case
library, and obtaining a fault mode of the tested device; generating a structured test demand table, wherein the structured test demand table comprises
test target priorities, constraint conditions and boundary value definitions; based on the structured test demand table and equipment working condition data acquired in real time, generating a plurality of test cases covering boundary conditions and extreme working conditions by using a
genetic algorithm; the test cases covering the boundary conditions and the extreme working conditions are screened out from the multiple test cases to obtain a
test case sequence, and each case in the
test case sequence comprises a
fault injection parameter, an expected response threshold value and an execution priority
label. According to the method and
system, the test coverage rate and efficiency are improved, and manual intervention is reduced.