which approaches do you recommend for testing a quite complex and matured code generator?
Since generator templates are quite often subject to changes I thought about primarily checking only whether certain target files exist or not depending on specific settings.
Target file content tests could probably be limited to the most elemental files. Or maybe it would make sense to search for some strings, for example to verify whether a function/method is included or not (testIfClassHasMethod)?
Karsten Thoms Messages: 561 Registered: July 2009 Location: Dortmund, Germany
I'm usually going fine to compare against reference files. Therefore try to reduce an existing project to a minimal reference, which produces much less code than the real world project, but covers all aspects of the generator. This can be challenging, but beneficial.
For generator utilities like name computations and the like cover them with unit tests.