Developing a flexible manufacturing system (FMS) controller is a complicated task both in the hardware development and software development. To test the control software prior to putting it into use is crucial for the development of a FMS controller. An intelligent testing environment for FMS controllers is under development, the aim of which is to reduce manual work in the testing. To reach this objective the automatic building of a behavioural model of the FMS is demanded. This paper proposes a generic Petri net (GPN) model and approach for the development of control software for FMSs. The principle of this approach is based on checking the control parts of FMSs with the help of temporal relationships between physical operations, and the specification of the FMS controller with GPN. The strategy of GPN modelling is then incorporated with more general problem solving strategies in artificial intelligence. A template is first defined for a GPN model, and then the model for FMS individuals is established in the form of instances of the template. The transitions of the GPN are represented with the proposed general expressions with two syntaxes, 'verb+ noun' and 'verb+ noun+ where', from which the GPN can be formulated. GPN makes it simple to express FMS controls, and procedural language can also be used for information processing. A case study for the testing of FMS controller software is provided to show effectiveness and cost saving over development with conventional methods in which only ordinary Petri net and procedural language are used.