Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Testing XText-based interpreter calling out to Henshin(Issue with tests calling out to non-Xtext language)
Testing XText-based interpreter calling out to Henshin [message #1726593] Mon, 14 March 2016 22:21 Go to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
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 #1726607 is a reply to message #1726593] Tue, 15 March 2016 04:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14064
Registered: July 2009
Senior Member
What do you do in your test. Is it a standalone or a ui test. Did you debug
what xtext runner and you henshin setup do with the end registry ....


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 15 March 2016 04:28]

Report message to a moderator

Re: Testing XText-based interpreter calling out to Henshin [message #1726608 is a reply to message #1726607] Tue, 15 March 2016 04:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14064
Registered: July 2009
Senior Member
p.s:

having a special look at GlobalStateMemento and YourDslInjectorProvider might help as well


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Testing XText-based interpreter calling out to Henshin [message #1726619 is a reply to message #1726593] Tue, 15 March 2016 07:38 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 748
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Have a look at http://grepcode.com/file/repo1.maven.org/maven2/org.sculptorgenerator/sculptor-generator-library/3.0.0/org/eclipselabs/xtext/utils/unittesting/XtextRunner2.java
This runner was written since we had a similar problem in the past with Xtext languages.


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Testing XText-based interpreter calling out to Henshin [message #1726621 is a reply to message #1726593] Tue, 15 March 2016 07:50 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Thanks, both, for these great tips. I will try these out and post back my findings. This may take me a little while, though, since something else has just come up that I need to tend to first.

Many thanks,

Steffen
Re: Testing XText-based interpreter calling out to Henshin [message #1726739 is a reply to message #1726593] Tue, 15 March 2016 22:39 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
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
Previous Topic:Xtext non-LL(*) for Declaration and Assignment
Next Topic:apparent wizard failure
Goto Forum:
  


Current Time: Thu Sep 23 06:01:43 GMT 2021

Powered by FUDForum. Page generated in 0.01640 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top