[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: How to run JUnit plugin tests from command line?

I found out a solution for this problem. You need to follow the following approach:

1) Make a new class that implements IStartup interface. Add a method in it as shown below:

	@Override
	public void earlyStartup() {
		TestResult result = new TestResult();
		AllTests.suite().run(result);
	}

There should be nothing like AllTests.suite().run(result) in your AllTests class.

2)Add an extension to your project "org.eclipse.ui.startup" (in the manifest editor). Double click on this after adding and then associate the class that you created in step 1 with this.

3) From eclipse run your plug-in/fragment as Eclipse Application. That will open a runtime eclipse and runs your tests on top of it as required.

4) Now go to the debug mode, right click on the main thread and see properties. Copy the command line argument from there and then run it from anywhere you want :)

Note: Delete the runtime-EclipseApplication folder from your workspace every time you run the command from the command line and don't delete the metadata from your workspace. If you delete workspace then you again have to repeat the whole procedure rather than just using the command next time.

Hope this will help.

-- Ankit Baphna

ankit baphna wrote:


by the way I am using junit 3.8 and Eclipse SDK Version: 3.4.0

ankit baphna wrote:

Hi all,

I have been using "Run .. -->JUnit Plugin Test" for testing my Eclipse plugin. It has been since now all manual testing. But I want to automatize this by writing an Ant task to run my Junit Plugin tests. What shall I do? Do I need anything extra like a plugin for this?

Thanks.