Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Headless testing for xtext(Headless testing for xtext)
icon5.gif  Headless testing for xtext [message #1292297] Fri, 11 April 2014 17:57 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi all,
I was trying out for headless testing for my code generators in my xtext project.
To begin with, I just created a java class (which is not present in ....tests project generated by xtext), Injected the injector and did emf registration. I have written a method (Say method name "callGenerators()") where my generators are called in the same class. And from the main method of this class I am trying to call this method i.e callGenerators(). But It doesn't look like all the injections have been injected properly. My injector, resourceset everything is null. But when I write the same code in JUNIT class then it works fine.

And I will execute this class from the command prompt for my headless testing.
This was just a try. Is this the right approach that I followed? Any further configurations needs to be done?

Or can someone tell me how to start with it if I am wrong.

Thanks in advance Smile


Arshad
Re: Headless testing for xtext [message #1292437 is a reply to message #1292297] Fri, 11 April 2014 20:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

can you please share code and exact steps to reproduce


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Headless testing for xtext [message #1312751 is a reply to message #1292297] Thu, 24 April 2014 13:28 Go to previous message
Holger Schill is currently offline Holger SchillFriend
Messages: 75
Registered: July 2009
Member
Did you use create a Injector? The standaloneSetup of a language can
create an injector or you can create a separated one for the generator.
The generator should be instantiated only through an injector. Otherwise
the injection will never work. May be you should have a look at
http://www.xpect-tests.org/ which handles generator tests in an easy way.

Cheers,
Holger


On 11.04.14 19:57, Arshad Adavani wrote:
> Hi all,
> I was trying out for headless testing for my code generators in my xtext
> project.
> To begin with, I just created a java class (which is not present in
> ....tests project generated by xtext), Injected the injector and did emf
> registration. I have written a method (Say method name
> "callGenerators()") where my generators are called in the same class.
> And from the main method of this class I am trying to call this method
> i.e callGenerators(). But It doesn't look like all the injections have
> been injected properly. My injector, resourceset everything is null. But
> when I write the same code in JUNIT class then it works fine.
>
> And I will execute this class from the command prompt for my headless
> testing.
> This was just a try. Is this the right approach that I followed? Any
> further configurations needs to be done?
>
> Or can someone tell me how to start with it if I am wrong.
>
> Thanks in advance :)


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:How to extend xbase::XBlockExpression?
Next Topic:Typesystem for own DSL
Goto Forum:
  


Current Time: Sat Apr 20 01:55:02 GMT 2024

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

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

Back to the top