Stand-alone tests for cross-model/multi-model projects [message #646089] |
Wed, 22 December 2010 01:16 |
Mirko Raner Messages: 125 Registered: July 2009 Location: New York City, NY |
Senior Member |
|
|
Hi all,
we're trying to put together some basic tests for a parser that has cross-references into another model. Interactively, the editor works fine, i.e., when you control-click on a name that refers to the other model the underlying file will be opened in the editor that's appropriate for the other model. So far, so good.
In the non-UI test set-up we simply call the set-ups for both models ("Flow" has cross-references into "Dialog"):
public static void doSetup()
{
new DialogStandaloneSetup().createInjectorAndDoEMFRegistration();
new FlowStandaloneSetup().createInjectorAndDoEMFRegistration();
}
The tests simply create an Xtext resource and obtain the EList of Diagnostics to determine that a file parses all right and/or shows the expected errors.
The problem is that in our tests we get error markers for cross-references into the other model (i.e., the reference cannot be resolved). Apparently, in the test environment, the "Flow" and "Dialog" models are not connected properly. So, it seems that there is some additional initialization happening that is performed automatically when the editor is launched interactively but is missing in our test set-up. Our test framework is also performing an EcoreUtil2.resolveAll(...) on the tested resource, so we assumed that all the cross references would be resolved by that. But maybe we're not understanding this properly.
Any ideas what we're missing here?
Thanks and happy holidays
|
|
|
|
|
Re: Stand-alone tests for cross-model/multi-model projects [message #646124 is a reply to message #646089] |
Wed, 22 December 2010 08:48 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
How do you create the XtextResource? You should use
myResourceSet.getResource(URI.createURI("somename.dialog"))
or use the ResourceFactoryRegistry directly
Resource.Factory.Registry.INSTANCE.createResource(URI.create URI( "somename.dialog"))
in order to get the same Injector instance every time.
Am 22.12.10 02:16, schrieb Mirko Raner:
> Hi all,
>
> we're trying to put together some basic tests for a parser that has
> cross-references into another model. Interactively, the editor works
> fine, i.e., when you control-click on a name that refers to the other
> model the underlying file will be opened in the editor that's
> appropriate for the other model. So far, so good.
> In the non-UI test set-up we simply call the set-ups for both models
> ("Flow" has cross-references into "Dialog"):
>
>
> public static void doSetup()
> {
> new DialogStandaloneSetup().createInjectorAndDoEMFRegistration() ;
> new FlowStandaloneSetup().createInjectorAndDoEMFRegistration();
> }
>
>
> The tests simply create an Xtext resource and obtain the EList of
> Diagnostics to determine that a file parses all right and/or shows the
> expected errors.
> The problem is that in our tests we get error markers for
> cross-references into the other model (i.e., the reference cannot be
> resolved). Apparently, in the test environment, the "Flow" and "Dialog"
> models are not connected properly. So, it seems that there is some
> additional initialization happening that is performed automatically when
> the editor is launched interactively but is missing in our test set-up.
> Our test framework is also performing an EcoreUtil2.resolveAll(...) on
> the tested resource, so we assumed that all the cross references would
> be resolved by that. But maybe we're not understanding this properly.
>
> Any ideas what we're missing here?
>
> Thanks and happy holidays :)
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03212 seconds