当前位置: 软件>java软件
Android 测试框架 RoboSpock
本文导语: RoboSpock 是一个开源的 Android 测试框架。提供简单的编写 BDD 行为驱动开发规范的方法,使用 Groovy 语音,支持 Google Guice 库。RoboSpock 合并了 Robolectric 和 Spock 的功能。 示例代码: def "should display hello text"() { given: ...
RoboSpock 是一个开源的 Android 测试框架。提供简单的编写 BDD 行为驱动开发规范的方法,使用 Groovy 语音,支持 Google Guice 库。RoboSpock 合并了 Robolectric 和 Spock 的功能。
![Android 测试框架 RoboSpock[图片]](/img/tech-article-img/img_1418307051_791067.jpeg)
示例代码:
def "should display hello text"() {
given:
def textView = new TextView(Robolectric.application)
and:
def hello = "Hello"
when:
textView.setText(hello)
then:
textView.getText() == hello
}