Tag: ui testing

如何开始:使用AssertJ Swing测试Java Swing GUI

在使用Swing开发Java桌面应用程序时,我遇到了直接测试UI的需要,而不仅仅是通过unit testing来测试底层控制器/模型类。 这个答案(关于“什么是基于Swing的应用程序的最佳测试工具?”)建议使用FEST ,遗憾的是停止使用。 然而,有一些项目从FEST离开的地方继续。 一个特别的(在这个答案中提到)引起了我的注意,因为我之前在unit testing中使用它: AssertJ 。 显然有AssertJ Swing ,它基于FEST,提供了一些易于使用的编写Swing UI测试的方法。 但是,进入初始/工作设置很麻烦,因为很难说从哪里开始。 如何为以下示例UI创建最小测试设置,仅包含两个类? 约束:Java SE,Swing UI,Maven项目,JUnit public class MainApp { /** * Run me, to use the app yourself. * * @param args ignored */ public static void main(String[] args) { MainApp.showWindow().setSize(600, 600); } /** * Internal standard method to initialize the view, […]

浓咖啡:选择后为什么纺纱厂不关门?

我有一个关于在Spinners with Espresso中选择商品的问题。 或者更确切地说:选择有效,但之后视图断言失败,因为微调器仍处于打开状态。 假设我有一个非常简单的活动,其中包含一个微调器和一个显示选择的textview,如下所示: 现在,我写了一个Espresso测试,选择’狗’并validationtextview是否相应更新: @Test public void selectDogs() throws Exception { onData(allOf(is(instanceOf(String.class)), is(“dogs”))) .inAdapterView(withId(R.id.spinner)) .perform(click()); onView(withId(R.id.selected)).check(matches(withText(“dogs”))); } 该测试失败,因为onData()…perform(click()); 没有关闭旋转器,它只是让它打开。 通过调试validation: 例外是: android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: org.flinc.app:id/selected If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one […]

在SWT-Widgets上自动生成ID

有没有办法在SWT-Widgets上自动生成ID,以便UI-Tests可以引用它们? 我知道我可以使用seData手动设置id,但我想以一种通用的方式为现有应用程序实现此function。

Selenium是Web UI测试,因为________是Windows应用程序UI测试

我对仅测试客户端Java应用程序的UI感兴趣。 这样做最流行的框架是什么? 你推荐的框架是什么? 另外,为什么Selenium不这样做(或者是这样做)? 在我看来,任何可以测试Web应用程序的东西都应该能够测试Windows应用程序。