Android 仪器测试套件
我在 com.app.myapp.test 包中编写了两个测试用例 当我尝试运行它们时,它们都没有被执行,只有一个测试用例被执行并停止。
中编写了以下测试套件
我在同一个包AllTests.java
public class AllTests extends TestSuite {
public static Test suite() {
return new TestSuiteBuilder(AllTests.class).includePackages("./src/com.ni.mypaint.test","./src/com.ni.mpaint.test").build();
/* .includeAllPackagesUnderHere()
.build();*/
}
该测试套件的代码和位置是否正确?
I have written two test cases in a package com.app.myapp.test
When I try to run them both of them are not getting executed, only one test case gets executed and stops.
I have written the following testsuite in the same package
AllTests.java
public class AllTests extends TestSuite {
public static Test suite() {
return new TestSuiteBuilder(AllTests.class).includePackages("./src/com.ni.mypaint.test","./src/com.ni.mpaint.test").build();
/* .includeAllPackagesUnderHere()
.build();*/
}
Is the code and location for this testsuite is correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,当然要省略该调用的包列表中的“/src/”部分。无论哪种方式,运行测试的最简单和最灵活的方法是确保所有测试都位于 AllTests 所在的子包中(例如 com.app.myapp.test.tests)并将其用于套件:
确保您的测试也可以单独运行,无需套件运行程序 - 如果一开始就设置错误,套件将不会接受您的测试。
(这比显式列出包名称更好,因为它更便携——例如,您可以重命名测试包而不破坏它。)
Well, certainly leave off the '/src/' portion of the package listing for that invocation. Either way, the easiest and most flexible way to run your tests this is to make sure all your tests are in a subpackage of where AllTests is (e.g. com.app.myapp.test.tests) and use this for the suite:
Make sure your tests run individually, too, without the suite runner -- the suite won't pick up your tests if they're set up wrong to begin with.
(This is better than explicitly listing the package name since it's more portable -- you can rename your test package without breaking it, for example.)