Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XPECT testing(XPECT testing for Xtext Grammar)
icon5.gif  XPECT testing [message #1112360] Thu, 19 September 2013 13:44 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hello all,
I am using xpect testing for my dsl testing.
I want to write a method in my java file, say to return "Hello".

And in my xpect file, say someName.dsl.xt
I want to call this java method, which should replace function call with "Hello" in my xpect file.

Is it possible ??

Thanks in advance Smile


Re: XPECT testing [message #1114808 is a reply to message #1112360] Mon, 23 September 2013 08:28 Go to previous message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
Hi Arshad,

I recently blogged about Xpect, see:

I'm not completely sure I understand what you have in mind. But here is some sketch, let me know how close it gets to what you imagined:

// XPECT_SETUP mypackage.MyJavaTest END_SETUP

// XPECT myTestMethod --> Hello Berlin
package mypackage;
class MyJavaTest {
  public void myTestMethod(@StringExpectation IStringExpectation expectation) {
    expectation.assertEqual("Hello Kiel")

If you run this test, the file someName.dsl.xt will invoke the method myTestMethod() from the Java class. The part after the "-->" will passed in as expectation. Consequently, the assertEqual fails because "Hello Berlin" does not equal "Hello Kiel". You can double-click on the failed test to open the comparison editor to compare/edit the failed expectation.

[Updated on: Mon, 23 September 2013 08:32]

Report message to a moderator

Previous Topic:URIImport of a non-xtext resource and referencing of its declared objects
Next Topic:AST always getting generated despite errors
Goto Forum:

Current Time: Thu Jul 09 09:25:29 GMT 2020

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

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

Back to the top