【问题标题】:AWS Device Farm Espresso tests orderAWS Device Farm Espresso 测试订单
【发布时间】:2016-03-14 15:12:18
【问题描述】:
我开始使用 Device Farm。我的问题是它忽略了我用来编写测试的顺序。在本地一切正常,因为 Espresso 以特定顺序执行测试。为了声明该顺序,我使用了字母顺序。我所有的课程都以字母开头(例如“A_EspressoTest”),因此我可以选择必须首先运行的课程。
在我使用的课程中
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
声明我的测试必须按什么顺序运行。
Device Farm 似乎也忽略了我的所有注释(例如 "@Test" ),因为它也在运行没有该注释的方法。
【问题讨论】:
标签:
android
amazon-web-services
android-espresso
【解决方案1】:
洛伦佐,
截至目前,无法指定 Espresso 的测试执行顺序。此外,您对 @Test 注释的观察是正确的,我们目前在发现选择了哪些测试类/测试方法时不使用它。
AWS Device Farm 当前发现基于 JUnit 3 样式命名约定的测试(以单词 Test 开头/结尾的类以及以单词 test 开头的这些类中的方法。
例如:
// This class would be automatically discovered (by name).
public class LoginTests extends InstrumentationTestCase {
// This method would be automatically discovered (by name).
public void testLoginFormUsingInvalidCredentials() {
// ...
}
// This method would **not** be automatically discovered.
@Test
public void loginWithValidCredentials() {
// ...
}
}
// This class would **not** be automatically discovered.
public class Login extends InstrumentationTestCase {
// This method would **not** be automatically discovered since the class was not discovered.
public void testLoginFormWithValidCredentials() {
// ...
}
}
话虽如此,我们已经听到了大量的反馈和请求,要求使用所有 JUnit 4 注释来支持测试发现,这是我们肯定会关注的一个改进领域。
希望有帮助!
最好的,
安德鲁@AWS Device Farm