java - SWTBot 测试读取欢迎页面文本

标签 java eclipse junit swt swtbot

我正在尝试编写一个 SWTBot 测试,它在 eclipse 中打开欢迎页面 View ,然后将内容读取/映射到某个对象(不关心是否只有字符串)所以我可以将它与预期的文本进行比较,我认为这是一个非常微不足道的问题,我会在互联网上找到例子,但我不能! 有什么帮助吗?

@Test
public void testExpandText() throws Exception {
    bot.menu(Constants.HELP_MENU).menu(Constants.WELCOME).click();
    welcomePageView = bot.viewByTitle(Constants.WELCOME);
    //expandText();
    //assertText();
    welcomePageView.close();
}

最佳答案

欢迎页面的内容好像是一个网页...可能现在SWTBot不支持

而且,如果您想查看一些示例测试代码,您可以尝试使用以下代码打开透视菜单。

bot.menu("Window").menu("Open Perspective").menu("Other...").click();
bot.shell("Open Perspective").activate();
bot.table().select("Debug");
//bot.table().getTableItem(2).getText(); //Get the 2nd line text of the list. 
bot.button("OK").click();

希望代码对你有用。

关于java - SWTBot 测试读取欢迎页面文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20351237/

相关文章:

java - Junit:如何使用 Get Class Instance 进行断言

java - 如何在Java循环中检查变量

java - Jtable - 滚动到底部并具有可变高度行

java - 如何找到两个数组中的对象并立即将其添加到另一个数组中?

java - Eclipse中获取当前编辑文件的绝对路径

java - 将 vaadin 应用程序部署到 tomcat

java - 包含 Google Cloud Client 库后在 Android Studio 中构建错误

java - 要通过 Maven 包含在 Eclipse 中的 Tomcat 库

java - 创建 JUnit 测试时没有此类方法错误

java - JUnit 测试中的父类