Skip to main content


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 09:27 Go to next message
Christoph Bittmann is currently offline Christoph BittmannFriend
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 06:19]

Report message to a moderator

Re: BundleActivator not called [message #1262006 is a reply to message #1260294] Mon, 03 March 2014 06:59 Go to previous message
Christoph Bittmann is currently offline Christoph BittmannFriend
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 Apr 26 02:23:05 GMT 2024

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

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

Back to the top