Acceleo Unit 0.1
It’s been a long time since I’ve worked on the unit testing framework for Acceleo. At that time, I had all the basis for the framework but I was missing some key elements and few hours of work to have a working prototype. Now that Acceleo 3.1 has been released, I had a bit more time to try and experiment and now I do have my working prototype.
First of all, it is still a prototype, as such it is still a bit raw and I have identify several new JUnit based annotations and some other utility operations that I should add to this framework in order to make it very easy for people to test their templates and queries. I also had to fork and override some key elements of the Acceleo engine in order to be able to access some elements of the OCL environment.
I would need new APIs in Acceleo in order to handle unit testing of queries. Since I didn’t want to have to touch any piece of code of Acceleo for this work, I didn’t create those APIs. Right now, I could easily evaluate any template containing a file block but with my fork of some Acceleo components I can now test all templates. As you can see in this screenshot of the unit test and the previous screenshot, I can test an Acceleo module compiled or not, in the workspace or in a plugin and with an EMF based model that also can be located pretty much anywhere too.
The method annotated ”modelElements” is a bit long, but it is because I am loading my UML model manually and then iterating on all the available model elements to select the first UML class. You could also use the method annotated “uriFragments” or the attribute annotated “uriFragment” to just give the uri fragments of the model elements that you want to test. So in the end, you can select by hand the model elements that will be used for the test or you can just give their uri and let Acceleo handle the rest. Finally it will even be available in stand alone without any dependencies with Eclipse.
I’ll have to discuss with the remaining members of the Acceleo dev’ team to determine how we could provide the necessary APIs for this framework but rest assured I have not forgotten this project and I know that some people out there are very interesting by it and I am planning on improving it a lot with some killer features. By the way, don’t forget to have a look at the new features coming with Acceleo 3.1 that has been released yesterday.
You can find more information on Acceleo on the Eclipse website, the Obeo Network or by following me on Twitter.