本文整理汇总了Java中org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences类的典型用法代码示例。如果您正苦于以下问题:Java SWTBotPreferences类的具体用法?Java SWTBotPreferences怎么用?Java SWTBotPreferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SWTBotPreferences类属于org.eclipse.swtbot.swt.finder.utils包,在下文中一共展示了SWTBotPreferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOfflineAppendMode
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@Test
public void testOfflineAppendMode() throws Exception {
GW4EProject project = new GW4EProject(bot, gwproject);
FileParameters fp = project.createSimpleProject ();
fp.setTargetFilename("SimpleOffLineImpl");
OfflineTestUIPageTest page = walkToToOfflinePage(gwproject,fp);
page.selectAppendMode("com.company.SimpleImpl.java - gwproject/src/main/java");
page.selectGenerators(new String [] {"random(edge_coverage(100))"});
page.finish();
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
IFile resource = (IFile) ResourceManager.getResource("gwproject/src/main/java/com/company/SimpleImpl.java");
boolean methodAppended = IOHelper.findInFile(resource, "Generated with : random(edge_coverage(100))");
return methodAppended;
}
@Override
public String getFailureMessage() {
return "method not generated ";
}
};
bot.waitUntil(condition, 3 * 6 * SWTBotPreferences.TIMEOUT); //3mn
closeWizard ();
}
示例2: testOfflineStandAloneMode
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@Test
public void testOfflineStandAloneMode() throws Exception {
GW4EProject project = new GW4EProject(bot, gwproject);
FileParameters fp = project.createSimpleProject ();
fp.setTargetFilename("SimpleOffLineImpl");
OfflineTestUIPageTest page = walkToToOfflinePage(gwproject,fp);
page.selectStandAloneMode("MyClazz");
page.selectGenerators(new String [] {"random(edge_coverage(100))"});
page.finish();
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
IFile resource = (IFile) ResourceManager.getResource("gwproject/src/main/java/com/company/MyClazz.java");
boolean methodAppended = IOHelper.findInFile(resource, "Generated with : random(edge_coverage(100))");
return methodAppended;
}
@Override
public String getFailureMessage() {
return "method not generated ";
}
};
bot.waitUntil(condition, 3 * 6 * SWTBotPreferences.TIMEOUT); //3mn
closeWizard ();
}
示例3: walkToToOfflinePage
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
private OfflineTestUIPageTest walkToToOfflinePage(String gwproject,FileParameters fp) throws CoreException, FileNotFoundException, BuildPolicyConfigurationException {
String targetFormat="offline";
String checkTestBox="Java Offline Test Based";
GW4EProject project = new GW4EProject(bot, gwproject);
ICondition convertPageReachedCondition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
boolean b = project.walkToToOfflinePage(fp.getProject(),fp.getPackageFragmentRoot(),fp.getPackage(), fp.getTargetFilename(), targetFormat,checkTestBox,fp.getGraphmlFilePath());
return b;
}
@Override
public String getFailureMessage() {
return "Unable to complete the wizard page.";
}
};
bot.waitUntil(convertPageReachedCondition, 3 * SWTBotPreferences.TIMEOUT);
SWTBotShell shell = bot.shell("GW4E Conversion File");
return new OfflineTestUIPageTest(shell);
}
示例4: convertToExisting
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
public void convertToExisting(String project, String packageRootFragment, String pkg, String targetFilename,
String targetFormat, String checkTestBox, String... nodes) {
ICondition condition = new DefaultCondition() {
@Override
public boolean test() throws Exception {
ConvertDialog cd = prepareConvertTo(project, packageRootFragment, pkg, targetFilename, targetFormat,
nodes);
boolean b = cd.createExisting(project, packageRootFragment, pkg, targetFilename, targetFormat,
checkTestBox);
return b;
}
@Override
public String getFailureMessage() {
return "Unable to complete the convert to wizard";
}
};
bot.waitUntil(condition, 3 * SWTBotPreferences.TIMEOUT);
}
示例5: initializePreferences
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
/**
* Sets common SWTBot preferences.
*/
public static void initializePreferences() {
// -Dorg.eclipse.swtbot.playback.delay=2
SWTBotPreferences.PLAYBACK_DELAY = BOT_PLAYBACK_DELAY;
// System.setProperty("org.eclipse.swtbot.keyboardLayout", "EN_US");
SWTBotPreferences.KEYBOARD_LAYOUT = "org.eclipse.swtbot.swt.finder.keyboard.EN_US";
// SWTBot Keyboard strategies
SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy";
// keyboard type interval
SWTBotPreferences.TYPE_INTERVAL = KEYBOARD_TYPE_INTERVAL;
// Waiting for Widgets
SWTBotPreferences.TIMEOUT = BOT_WIDGET_TIMEOUT;
// screenshot directory
SWTBotPreferences.SCREENSHOTS_DIR = System.getProperty(SWTBotPreferenceConstants.KEY_SCREENSHOTS_DIR, "target/screenshots");
// test window focus policy
workbenchFocusPolicy = WorkbenchFocusPolicy.valueOf(System.getProperty(PROPERTY_COM_AVALOQ_TEST_WORKBENCHFOCUSPOLICY, WorkbenchFocusPolicy.REFOCUS.toString()));
preferencesInitialized = true;
}
示例6: testDeChKeyboardLayout
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
/**
* Tests com.avaloq.test.swtbot.DE_CH.
*/
@Test
public void testDeChKeyboardLayout() {
SWTBotPreferences.KEYBOARD_LAYOUT = "com.avaloq.test.swtbot.DE_CH";
SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.MockKeyboardStrategy";
SwtWorkbenchBot bot = new SwtWorkbenchBot();
bot.closeWelcomePage();
bot.menu("File").menu("New").menu("Untitled Text File").click();
SWTBotEclipseEditor editor = bot.activeEditor().toTextEditor();
editor.setFocus();
editor.typeText(EXPECTED_RESULT);
String actualResult = editor.getText();
bot.closeAllEditors();
assertEquals("Written and read characters must exactly match", EXPECTED_RESULT, actualResult);
}
示例7: setUp
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
/**
* 每个测试开始之前执行
*/
@Before
public void setUp() {
if (SLOW_PLAYBACK) {
SWTBotPreferences.PLAYBACK_DELAY = 500;
}
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
bot = HSBot.bot();
bot.closeAllEditors();
ts = TS.getInstance();
prjName = "swtBot-Project-001";
fileName = "HSCAT8-3.xlf";
ProjectTreeView.doubleClickXlfFile(prjName, fileName);
xe = new XlfEditor(bot.editorByTitle(fileName));
}
示例8: closeWelcomePage
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@BeforeClass
public static void closeWelcomePage() {
try {
SWTBotPreferences.TIMEOUT = 6000;
new SWTGefBot().viewByTitle("Welcome").close();
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: closeWelcomePage
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@BeforeClass
public static void closeWelcomePage() {
try {
SWTBotPreferences.TIMEOUT = 6000;
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: testOfflineExpandedMode
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@Test
public void testOfflineExpandedMode() throws CoreException, BuildPolicyConfigurationException, IOException, InterruptedException {
GW4EProject project = new GW4EProject(bot, gwproject);
FileParameters fp = project.createSimpleProject ();
fp.setTargetFilename("SimpleOffLineImpl");
OfflineTestUIPageTest page = walkToToOfflinePage(gwproject,fp);
page.selectExtendedMode("com.company.SimpleImpl.java - gwproject/src/main/java","MyClazz");
page.selectGenerators(new String [] {"random(edge_coverage(100))"});
page.finish();
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
IFile resource = (IFile) ResourceManager.getResource("gwproject/src/main/java/com/company/MyClazz.java");
boolean methodAppended = IOHelper.findInFile(resource, "Generated with : random(edge_coverage(100))");
return methodAppended;
}
@Override
public String getFailureMessage() {
return "method not generated ";
}
};
bot.waitUntil(condition, 3 * 6 * SWTBotPreferences.TIMEOUT); //3mn
closeWizard ();
}
示例11: testConvertTo
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
private void testConvertTo(String targetFormat,String checkTestBox) throws CoreException, FileNotFoundException, BuildPolicyConfigurationException {
GW4EProject project = new GW4EProject(bot, gwproject);
project.createInitialProjectWithoutError(TEST_RESOURCE_FOLDER, PACKAGE_NAME, graphMLFilename);
FileParameters fp = FileParameters.create(targetFormat);
IFolder folder = ResourceManager.createFolder(fp.getMainSourceFolder(), PACKAGE_NAME);
ICondition folderExistsCondition = new FolderExists (folder);
bot.waitUntil(folderExistsCondition, SWTBotPreferences.TIMEOUT);
ICondition convertPageCompletedCondition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
boolean b = project.convertTo(fp.getProject(),fp.getPackageFragmentRoot(),fp.getPackage(), fp.getTargetFilename(), targetFormat,checkTestBox,fp.getGraphmlFilePath());
return b;
}
@Override
public String getFailureMessage() {
return "Unable to complete the wizard page.";
}
};
bot.waitUntil(convertPageCompletedCondition, 3 * SWTBotPreferences.TIMEOUT);
IProject pj = ResourceManager.getProject(fp.getProject());
bot.waitUntil(new PathFoundCondition(pj,fp.getPath()),30 * 1000);
}
示例12: beforeClass
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
SWTBotPreferences.TIMEOUT = 10000;
bot = new SWTWorkbenchBot();
try {
bot.viewByTitle("Welcome").close();
} catch (Exception e) {
e.printStackTrace();
}
}
示例13: setUp
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
@Before
public void setUp() throws CoreException {
long timeout = SWTBotPreferences.TIMEOUT;
try {
SWTBotPreferences.TIMEOUT = 3 * 60 * 1000;
bot.resetWorkbench();
GW4EProject.cleanWorkspace();
GW4EPerspective.openGWPerspective(bot);
} finally {
SWTBotPreferences.TIMEOUT = timeout;
}
}
示例14: prepareconvertTo
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
public boolean prepareconvertTo(String project, String packageRootFragment, String pkg, String targetFilename,
String targetFormat, String checkTestBox,String annotationStartElement,
String targetvertex,String startElement,String [] contexts, String... nodes) {
ConvertDialog cd = prepareConvertTo(project, packageRootFragment, pkg, targetFilename, targetFormat, nodes);
boolean ret = cd.create(project, packageRootFragment, pkg, targetFilename, targetFormat, checkTestBox, false);
if (!ret) {
SWTBotShell shell = bot.shell("GW4E Conversion File");
shell.bot().button("Cancel").click();
bot.waitUntil(Conditions.shellCloses(shell));
return false;
}
SWTBotButton fbutton = bot.button("Next >");
fbutton.click();
GraphWalkerTestUIPageTest gwid = new GraphWalkerTestUIPageTest(cd.getShell());
gwid.completeFullPage("random(edge_coverage(100))", "GROUP1;GROUP2", annotationStartElement);
gwid.nextPage();
JUnitGraphWalkerTestUIPageTest jugw = new JUnitGraphWalkerTestUIPageTest(cd.getShell());
jugw.completeFullPage(targetvertex, startElement, contexts);
jugw.nextPage();
GraphWalkerTestHookPageTest gwth = new GraphWalkerTestHookPageTest(cd.getShell());
gwth.completeFullPage();
gwth.finish();
bot.waitUntil(Conditions.shellCloses(cd.getShell()), 6 * SWTBotPreferences.TIMEOUT);
return true;
}
示例15: create
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; //导入依赖的package包/类
public boolean create (String project,String packageRootFragment, String pkg,String targetFilename,String targetFormat,String checkTestBox,boolean finish) {
try {
prepare (project,packageRootFragment,pkg,targetFilename,targetFormat, checkTestBox);
if (!finish) return true;
SWTBotButton fbutton = bot.button("Finish");
fbutton.click();
bot.waitUntil(Conditions.shellCloses(this.shell), 10 * SWTBotPreferences.TIMEOUT);
return true;
} catch (TimeoutException e) {
return false;
}
}