The application of metaheuristic search techniques in test data generation has been extensively investigated in recent years. Most studies, however, have concentrated on the application of such techniques in structural testing. The use of search-based techniques in functional testing is less frequent, the main cause being the implicit nature of the specification. On the other hand, such techniques could be employed in functional test generation if an explicit, graph-based, model, that describes the algorithm used to produce the required results, existed. However, the process of creating and validating such a model is usually a highly-specialized and time consuming task, which quite often cannot be economically justified in the case of non-safety-critical applications. In this paper we propose a framework for genetic model based testing. Under this framework, a graph-based model of the system under test is built using a genetic algorithm. Test data is then derived from the resulting model using (possibly) metaheuristic search techniques to provide the desired level of coverage. The approach is illustrated with a case study: an array sorting program.