The invention provides a CAPL code automatic generation method and system and an automobile. The method comprises the steps that a DBC file of a communication matrix is acquired; key information of each CAN bus in the DBC file is extracted; based on the key information of each CAN bus, an independent CAPL language code file is automatically generated, and the CAPL language code file comprises a message signal analysis function, a message verification function, a message counting function, a simulation message stop function, a simulation frame loss function, a simulation message verification error function and a simulation message counting error function; the method also includes operating CANoe software or CANalyzer software, connecting any hardware equipment in the CANoe software or the CANalyzer software, and importing a DBC file to a CAN channel of any hardware equipment in a Database Management environment; inserting a programming node in a Measurement Setup environment, importing a CAPL language code file, and compiling the CAPL language code file; and connecting the CAN bus channel of the electronic control unit with the CAN channel of any device. According to the invention, the problems that the manual configuration of the existing CAN tool is tedious and the Dspace rack is inconvenient to carry are solved.