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
[Updated on: Mon, 03 March 2014 06:19]
Report message to a moderator