Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Junit for Dependent DSL(How to Create a Dependent Junit Test case of two dependent Grammars)
Junit for Dependent DSL [message #1248210] Mon, 17 February 2014 03:14 Go to next message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

I try to test Model using Junit like below code :
===================================================
@RunWith(typeof(XtextRunner))
@InjectWith(typeof (MyDslInjectorProvider))
class MyDslParserTest{
@Inject extension ParseHelper modelParserHelper
@Inject extension ValidationTestHelper

@Test
def testMyDslParser(){
var model=modelParserHelper.parse("'

Hello Test!!
viewName:Player
"')
model.assertNoErrors()

}

}

==========================================
I get below result when I run above Junit :

java.lang.AssertionError: Expected no errors, but got :ERROR (org.eclipse.xtext.diagnostics.Diagnostic.Linking) 'Couldn't resolve reference to ViewType 'Player'.' on ViewDefinition

=========================================
here View Name is Grammar that has been imported from other grammar file AdSym.

The problem is in such scenario, how do I write Junit to test grammar included by other grammars also .

Cheers

Kunal
Re: Junit for Dependent DSL [message #1248355 is a reply to message #1248210] Mon, 17 February 2014 06:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi this was answered just a few days ago
http://www.eclipse.org/forums/index.php/t/648014/

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Use code generator from Eclipse and CLI
Next Topic:Exporting DSL Plugins as Eclipse Product
Goto Forum:
  


Current Time: Wed Apr 24 23:47:07 GMT 2024

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

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

Back to the top