Junit 跨多种配置(纵向和横向)测试 Android
我刚刚开始使用 Robotium
& Junit
用于测试 Android 应用程序。
我想编写一次测试,然后运行完全相同的测试两次......一次是纵向,一次是横向。
我习惯于 Nunit/C#
具有这样的测试用例属性:
[TestCase(12,3,4)]
[TestCase(12,2,6)]
[TestCase(12,4,3)]
public void DivideTest(int n, int d, int q)
{
Assert.AreEqual( q, n / d );
}
我可以在 Eclipse
中使用 Java/Robotium
做类似的事情吗?
I am just starting to use Robotium
& Junit
to test an android app.
I want to write a test once and then have that exact same test run twice... once in portrait and once in landscape.
I am used to Nunit/C#
with test case attributes like this:
[TestCase(12,3,4)]
[TestCase(12,2,6)]
[TestCase(12,4,3)]
public void DivideTest(int n, int d, int q)
{
Assert.AreEqual( q, n / d );
}
Is there something like that I can do in Eclipse
with Java/Robotium
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以使用 Robotium 和 Java 来完成此操作。您要做的就是创建两个测试方法。您必须以“test”开头,因此在您的情况下,它将是 testDivideTest1() 和 testDivideTest2()...创建方法后,您将使用
setActivityOrientation(intorientation)
方法在测试开始时。因此,您的测试可能如下所示:测试二:
希望有所帮助。以下是参考链接:http://code.google.com/p/robotium/wiki /QuestionsAndAnswers
此链接包含下载 javadoc 的链接,其中包含所有所需的方法。当您下载 javadoc 时,它将是一个 .jar 文件,因此只需将 .jar 更改为 .zip 即可访问它。
Yes, you can do this using Robotium and Java. What you would do is create two test methods. You have to begin them with "test", so in your case it would be testDivideTest1() and testDivideTest2()... Once you create the methods, you will use the
setActivityOrientation(int orientation)
method at the beginning of your test. So your test might look something like this:Test two:
Hope that helps. Here is a reference link: http://code.google.com/p/robotium/wiki/QuestionsAndAnswers
This link has the link to download the javadoc which has all the needed methods. When you download the javadoc, it will a .jar file, so just change the .jar to .zip and you will be able to access it.