We report a method to automatically generate test cases for automotive embedded software from a UML-based model using XML metadata interchange (XMI). First, the software model created using UML is converted to metadata in XMI format. Then, based on this metadata (which does not depend on a specific language), software test cases for structural testing or requirement-based testing may be generated using an appropriate parser. The model does not need to be implemented using the Object Constraint Language (OCL), and software test cases may be generated using an appropriately defined parser for a given language (which may be C/C++). Because software test cases can be converted to hardware test cases via a stimulus-mapping table, which contains the information on the digital and analog signals, and the communications interface, hardware test cases may also be generated automatically. The use of automatic test-case generation for structural testing and requirement-based testing can lead to a considerable reduction in the workload involved in testing embedded software.