Macchiato是Espresso额外助手(BDDhelpersforAndroid)。
下载安装步骤:
从此处下载和查看最新版本macchiato的发型说明。
在你的项目中创建一个库目录(如果没有的话),并在添加下面这些依赖项代码到你的build.gradle库中,添加)
repositories { flatDir { dirs 'libs' }}下载并复制macchiato.aar文件到你的库中fileyoudownloadedintolibs
最后添加依赖项到你的build.gradle:
dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.0') androidTestCompile('com.android.support.test:testing-support-lib:0.1') androidTestCompile(name:'macchiato-0.1.0', ext:'aar')}代码示例:
import static io.pivotal.macchiato.*;public class WaxTest extends ActivityInstrumentationTestCase2<DisActivity> { public WaxTest() { super(WaxActivity.class); } public void testOnAndOff() { getActivity(); assertHasText("On") assertDoesNotHaveText("Off") clickOn(R.id.wax) assertDoesNotHaveText("On") assertHasText("Off") }}
评论