[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[swtbot-dev] How to open an existing eclipse application for further test with SWTBot
|
Dear All,
I am new to SWTBot and learninng to use it. I am trying to use it to test existing eclipse application. I followed the user guide and always got the new application. But what i want is how to open an existing java application (launch eclipse application abc.product under the project com.project.application in Package Explorer view or click abc.product in drop down toolbar Run if it was launched before) then log in and do furthur test. Can you tell me how to open the existing eclipse application separately just like in examples we have opened new Eclipse instance?
The script I wrote is as following, it would be great if you can help me to modify it. Thanks again
import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class Example1 {
private static SWTEclipseBot bot;
@Test
public void canLoginExplorer() throws Exception {
bot.toolbarDropDownButtonWithTooltip("Run").menuItem("abc.product").click(); //run abc.product as eclipse application
bot.shell("Explorer").activate(); // the application named as Explorer is open
bot.textWithLabel("User Name").setText("user"); // enter user name
bot.textWithLabel("Password").setText("pass"); //enter password
bot.button("Login").click();
}
@AfterClass
public static void sleep() {
bot.sleep(8000);
}
}
Best regards,
Kevin