Testing XText-based interpreter calling out to Henshin [message #1726593] |
Mon, 14 March 2016 18:21  |
Eclipse User |
|
|
|
Hi,
I'm working on a small DSL written in XText. Its interpreter calls out to Henshin (for some graph transformations).
When setting up unit tests for this using the standard Xtext test set up, I noticed that the second interpreter test run in any test-suite run will fail (regardless of the order in which I run tests) because it cannot find the Henshin meta-model in the registry.
I have looked at https://www.eclipse.org/forums/index.php/t/823170/ , but that doesn't seem to apply here as Henshin isn't an XText language. I assume, though, that the test runner kicks Henshin out of the registry after the first test has run.
Where should I look to figure out how to fix this?
Many thanks,
Steffen
|
|
|
|
|
|
|
Re: Testing XText-based interpreter calling out to Henshin [message #1726739 is a reply to message #1726593] |
Tue, 15 March 2016 18:39  |
Eclipse User |
|
|
|
Hi,
I managed to fix it. It turned out I didn't need the specialised text runner. Instead, all I had to do was to add the following line of code to setupRegistry in my test injector provider class:
EPackage.Registry.INSTANCE.put(HenshinPackage.eNS_URI, HenshinPackage.eINSTANCE);
I think, this is a bug in org.eclipse.xtext.junit4.GlobalRegistries: When storing the global state, it doesn't deal correctly with global package registries that are delegate registries: in this case, it only keeps track of what is in the main registry, but not of what is in the delegate registry. In my case, the Henshin meta-model was registered in the delegate registry only, so when restoreGlobalState was called, the registry entry was removed. Should I report this or is this considered a feature and I am just missing an important point?
Many thanks,
Steffen
|
|
|
Powered by
FUDForum. Page generated in 0.09517 seconds