Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Errors while running Xtext Junit from command line
Errors while running Xtext Junit from command line [message #1413361] Thu, 28 August 2014 11:03 Go to next message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

Hi,
I have written a DSL and added Junit test case using Xtext Junit by injecting AdInjectorProvider .

When I run from eclipse I am able to run the Test case , but if I run from command line by adding all the required jars in classpath, it gives below error:
 1) No implementation for javax.inject.Provider<org.eclipse.emf.ecore.resource.ResourceSet> was bound.
     [java]   while locating javax.inject.Provider<org.eclipse.emf.ecore.resource.ResourceSet>
     [java]     for field at com.mydsl.TestMyDsl.resourceSet(TestMyDsl.java:48)
     [java]   while locating com.mydsl.TestMyDsl


Any Help is really Appreciated.

Cheers
Kunal

[Updated on: Thu, 28 August 2014 11:05]

Report message to a moderator

Re: Errors while running Xtext Junit from command line [message #1414272 is a reply to message #1413361] Sat, 30 August 2014 20:57 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1755
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 28/08/2014 13:03, Kunal Khaware wrote:
> Hi,
> I have written a DSL and added Junit test case using Xtext Junit by
> injecting AdInjectorProvider .
>
> When I run from eclipse I am able to run the Test case , but if I run
> from command line by adding all the required jars in classpath, it gives
> below error:
>
> 1) No implementation for
> javax.inject.Provider<org.eclipse.emf.ecore.resource.ResourceSet> was
> bound.
> [java] while locating
> javax.inject.Provider<org.eclipse.emf.ecore.resource.ResourceSet>
> [java] for field at
> com.mydsl.TestAdXtext.resourceSet(TestMyDsl.java:48)
> [java] while locating com.mydsl.TestMyDsl
>
>
> Any Help is really Appreciated.
>
> Cheers
> Kunal

Hi

how do you run it from the command line?

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: Errors while running Xtext Junit from command line [message #1414709 is a reply to message #1414272] Mon, 01 September 2014 05:51 Go to previous messageGo to next message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

Hi,
I have created a TestRunner Class to run all Xtext Junit Class like below:
public static void main(String[] args) {
		Result result = JUnitCore.runClasses(MyDslTestSuite.class);
		int totalTestCasesCount = result.getRunCount();
		int failureCount = result.getFailureCount();
		System.out.println("-------------------------------------------------------------");
		System.out.println("Total Test Cases Executed = "+totalTestCasesCount);
		System.out.println("Total Test Cases Passed = "+(totalTestCasesCount - failureCount));
		System.out.println("Total Test Cases Failed = "+failureCount);
		System.out.println("Total Time taken to execute all test cases = "+result.getRunTime() +" milliseconds");
	    for (Failure failure : result.getFailures()) {
	      System.out.println(failure.toString());
	    }
	    System.out.println("-------------------------------------------------------------");
	}

While MyDslTestSuite class contains code to invoke all Junit class.Code looks like below :
import org.junit.runner.RunWith;
import org.junit.runners.Suite;


@RunWith(Suite.class)
@Suite.SuiteClasses(
		{
			TestMyDslXtext.class
		}
		)
public class MyDslTestSuite {

	
	
}

After this, I have added all xtext libraries in classpath and ran TestRunner class from command line using command
java TestRunner
.
But after I see the the exception that I added in previous post.

Cheers
Kunal
Re: Errors while running Xtext Junit from command line [message #1415989 is a reply to message #1414709] Thu, 04 September 2014 05:30 Go to previous messageGo to next message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

Hi Lorenzo Bettini,
Any Luck for the above please !!!
Re: Errors while running Xtext Junit from command line [message #1416005 is a reply to message #1415989] Thu, 04 September 2014 06:20 Go to previous messageGo to next message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

This Post seems to be continuation of https://www.eclipse.org/forums/index.php/m/1416000/#msg_1416000
Re: Errors while running Xtext Junit from command line [message #1416014 is a reply to message #1415989] Thu, 04 September 2014 06:49 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1755
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 04/09/2014 07:30, Kunal Khaware wrote:
> Hi Lorenzo Bettini,
> Any Luck for the above please !!!

sorry but I don't know: to run tests from the command line I use build
tools like maven/tycho or buckminster

Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: Errors while running Xtext Junit from command line [message #1416100 is a reply to message #1416014] Thu, 04 September 2014 10:07 Go to previous message
Kunal Khaware is currently offline Kunal KhawareFriend
Messages: 41
Registered: December 2013
Location: Hyderabad,India
Member

Hi Lorenzo,
I have used ant build script and inside that I am using Junit target to run xtext junit test cases.

Cheers
Kunal
Previous Topic:Headless Xcore generation with edit plug-in
Next Topic:My DSL plugin install fails
Goto Forum:
  


Current Time: Wed Dec 11 17:43:24 GMT 2019

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

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

Back to the top