Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatter2 Junit test passes in Eclipse but fails in maven (Xtext 2.10.0)
Formatter2 Junit test passes in Eclipse but fails in maven (Xtext 2.10.0) [message #1752175] Thu, 19 January 2017 13:27 Go to next message
Jeroen Laverman is currently offline Jeroen LavermanFriend
Messages: 2
Registered: December 2016
Junior Member
Hi there,

I have 3 different DSLs (A,B,C). A references elements from B; and B references elements from C.
I implemented a Formatter2-based formatter + Junit-Tests for each of the DSLs.

While the tests for C passes in Eclipse as well as in Maven, the tests for A and B only run in Eclipse (Run As -> JUnit Test) but fail with Maven (mvn verify).

The error message is a "org.junit.ComparisonFailure" similar to the in the quote (problems with formatter2 in Xtext 2.9).

Thankful for any idea Smile

Lorenzo Bettini wrote on Wed, 18 November 2015 13:25
On 15/11/2015 10:44, Lorenzo Bettini wrote:

.....

org.junit.ComparisonFailure: expected:<...inaryOperation
X[AdditiveExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
B XFeatureCall
XAdditiveExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
286 2 S "t1"
XFeatureCall:feature=[JvmIdentifiableElement|IdOrSuper]
E XFeatureCall
XAdditiveExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
288 1 H " " Whitespace:TerminalRule'WS'
289 1 S "-"
XAdditiveExpression:feature=[JvmIdentifiableElement|OpAdd]
290 1 H " " Whitespace:TerminalRule'WS'
B XFeatureCall
XAdditiveExpression:rightOperand=XMultiplicativeExpression
path:XBinaryOperation/rightOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
291 2 S "t0"
XFeatureCall:feature=[JvmIdentifiableElement|IdOrSuper]
E XFeatureCall
XAdditiveExpression:rightOperand=XMultiplicativeExpression
path:XBinaryOperation/rightOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
E XBinaryOperation XAdditive]Expression:{XBinaryO...> but
was:<...inaryOperation
X[RelationalExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
B XFeatureCall
XAdditiveExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
286 2 S "t1"
XFeatureCall:feature=[JvmIdentifiableElement|IdOrSuper]
E XFeatureCall
XAdditiveExpression:{XBinaryOperation.leftOperand=}
path:XBinaryOperation/leftOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
288 1 H " " Whitespace:TerminalRule'WS'
289 1 S "-"
XAdditiveExpression:feature=[JvmIdentifiableElement|OpAdd]
290 1 H " " Whitespace:TerminalRule'WS'
B XFeatureCall
XAdditiveExpression:rightOperand=XMultiplicativeExpression
path:XBinaryOperation/rightOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
291 2 S "t0"
XFeatureCall:feature=[JvmIdentifiableElement|IdOrSuper]
E XFeatureCall
XAdditiveExpression:rightOperand=XMultiplicativeExpression
path:XBinaryOperation/rightOperand=XBinaryOperation/leftOperand=XIfExpression/if=XBlockExpression/expressions[4]=Rule/thenPart=Model/declarations[2]
E XBinaryOperation XRelational]Expression:{XBinaryO...>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at
org.eclipse.xtext.junit4.formatter.FormatterTester.createRegionAccess(FormatterTester.java:160)
at
org.eclipse.xtext.junit4.formatter.FormatterTester.assertFormatted(FormatterTester.java:99)
at
org.eclipse.xtext.junit4.formatter.FormatterTester.assertFormatted(FormatterTester.java:117)
at
org.eclipse.xtext.example.homeautomation.tests.FormatterTest.test(FormatterTest.java:24)
at
org.eclipse.xtext.example.homeautomation.tests.AbstractTest.test3(AbstractTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.eclipse.xtext.junit4.XtextRunner$1.evaluate(XtextRunner.java:49)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Re: Formatter2 Junit test passes in Eclipse but fails in maven (Xtext 2.10.0) [message #1752409 is a reply to message #1752175] Mon, 23 January 2017 14:10 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1729
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

in my case, the failure was reproducible in Eclipse as well... if your tests fail only during the Maven build I think it could be related to something else. Typically, when this happens, it is due to classloader problems (in Tycho the classloader is kind of different). One possible way to check that is to run in Eclipse your Junit tests as Junit Plug-in tests, and see if you get the failures as well.
Previous Topic:Xtext Summit @ EclipseCon France
Next Topic:Xtext 2.10.0 Intellij Gradle Task [lang].idea:downloadIdea fail (proxy authentication required)
Goto Forum:
  


Current Time: Wed May 24 04:29:27 GMT 2017

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

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