Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » BundleActivator not called(BundleActivator not called on SWTBot Test)
BundleActivator not called [message #1260294] Sat, 01 March 2014 04:27 Go to next message
Christoph Bittmann is currently offline Christoph Bittmann
Messages: 2
Registered: March 2014
Junior Member
Hi,

I like to write some tests with SWTBot for a Eclipse-RCP application.

The application for test generate some test data in the activator when the plugin is started:

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

	public void start(BundleContext context) throws Exception {
               // generate some test data and register IAddressService as OSGI-Service
		context.registerService(IAddressService.class.getName(), new RandomDataAddressService(), null);
	}
}


When I start the SWTBot-Test the Activator.start() ist never called. This means there are no test-data availabale and all SWTBot-Test failed.

--> How is it possible that Activator.start() is called on start of the SWTBot test?


SWTBot test
private final SWTWorkbenchBot bot = new SWTWorkbenchBot();

	@Before
	public void setup() {
		bot.resetWorkbench();
	}

	@Test
	public void testOpenAddress() {
		final SWTBotTable table = waitForAddressTable();

                // table is empty --> test fails
		table.select("Bernd Meyer", "Christa Schäfer");
		table.contextMenu("&Open").click();
		assertEquals("Two editors opened", 2, bot.editors().size());
	}


Application for testing
index.php/fa/17608/0/

[Updated on: Mon, 03 March 2014 01:19]

Report message to a moderator

Re: BundleActivator not called [message #1262006 is a reply to message #1260294] Mon, 03 March 2014 01:59 Go to previous message
Christoph Bittmann is currently offline Christoph Bittmann
Messages: 2
Registered: March 2014
Junior Member
Hi, I found a solution:

The bundle, thats Activator generate the testdata, must configured to autostart in the test run-configuration :
index.php/fa/17619/0/
Previous Topic:SWTBot 2.2.1 is released!
Next Topic:Button in view
Goto Forum:
  


Current Time: Fri Jul 25 03:06:37 EDT 2014

Powered by FUDForum. Page generated in 0.04207 seconds