保存自动安卓espresso测试结果
答
可以使用导出的测试结果“出口测试结果”选项的.html,或.XML文件。
如果这还不够,再看看Android的测试输出控制台。您可以复制粘贴命令并使用例如脚本创建您自己的脚本。 PowerShell,或任何你想要的。同时检查this link
编辑: 啊,对不起,我想我没有正确读取。你想在每次测试后将结果作为代码中的对象来捕获?所以..你不能使用@after
- 你的功能不能使用任何参数。通过使用TestWatcher您可以获得Description
对象,但我没有看到有关测试时间的信息。但是,如果你计算时间在自己的..
@RunWith(AndroidJUnit4.class)
public class TestClass {
private long startTime;
@Rule
public TestRule watcher = new TestWatcher() {
@Override
protected void failed(Throwable e, Description description) {
long estimatedTime = System.currentTimeMillis() - startTime;
}
@Override
protected void succeeded(Description description) {
long estimatedTime = System.currentTimeMillis() - startTime;
}
};
@org.junit.Test
public void Test() {
startTime = System.currentTimeMillis();
//your test here
}
}
希望它能帮助!