AWS Device Farm Espresso 测试订单

AWS Device Farm Espresso tests order

我开始使用 Device Farm。我的问题是它忽略了我用来编写测试的顺序。在本地一切正常,因为 Espresso 按特定顺序执行测试。为了声明该顺序,我使用了字母顺序。我所有的 class 都是以字母开头的(例如 "A_EspressoTest"),所以我可以选择 class 必须先 运行。

进入我的 classes 我使用

@FixMethodOrder(MethodSorters.NAME_ASCENDING)

声明我的测试必须按什么顺序 运行。

Device Farm 似乎也忽略了我的所有注释(例如“@Test”),因为它 运行 也是没有该注释的方法。

洛伦佐,

截至今天,无法指定 Espresso 的测试执行顺序。此外,您对 @Test 注释的观察是正确的,我们目前在发现选择了哪些测试 classes/test 方法时不使用它。

AWS Device Farm 目前发现基于 JUnit 3 样式命名约定的测试(类 starting/ending 中的单词 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