机器人的参数化
我一直在尝试在 Robotium 中实现数据库,以便我可以参数化并使其面向数据,但我完全迷失了,请指导我。下面提到了我的 Robotium 代码,请指导我如何使用 sqlite 打开数据库连接。
package com.dialog.test;
import android.test.ActivityInstrumentationTestCase2;
import com.jayway.android.robotium.solo.Solo;
public class TestNew extends ActivityInstrumentationTestCase2 {
private Solo solo;
//private Activity Main;
private static Class class1;
static
{
try {
class1=Class.forName("com.botskool.DialogBox.DialogBox");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public TestNew() {
super("com.botskool.DialogBox", class1);
}
@Override
protected void setUp() throws Exception {
super.setUp();
this.solo = new Solo(getInstrumentation(), getActivity());
}
@Override
protected void tearDown() throws Exception{
try {
this.solo.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
public void testDisplay(){
solo.clickOnButton(0);
solo.clickOnButton("Ok");
solo.clickOnButton(2);
}
}
即使是最小的指导也会有很大的帮助,谢谢
I have been trying to implement database in robotium so that i can parametrize and make it data oriented but i am completely lost please guide me.My robotium code is mentioned below please guide me on how can i open a database connection with sqlite.
package com.dialog.test;
import android.test.ActivityInstrumentationTestCase2;
import com.jayway.android.robotium.solo.Solo;
public class TestNew extends ActivityInstrumentationTestCase2 {
private Solo solo;
//private Activity Main;
private static Class class1;
static
{
try {
class1=Class.forName("com.botskool.DialogBox.DialogBox");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public TestNew() {
super("com.botskool.DialogBox", class1);
}
@Override
protected void setUp() throws Exception {
super.setUp();
this.solo = new Solo(getInstrumentation(), getActivity());
}
@Override
protected void tearDown() throws Exception{
try {
this.solo.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
public void testDisplay(){
solo.clickOnButton(0);
solo.clickOnButton("Ok");
solo.clickOnButton(2);
}
}
Even the smallest guidance would be of great help thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用java的File IO集成到robotium脚本中。提供 Android 设备中路径的文件路径,例如 /system/docs/test1.txt 。您可以在文件中提供详细信息,然后使用 adb push 命令将文件推送到设备。当脚本运行时,您的参数将被访问。我给你 Robotium 测试用例的示例代码:
You can use File IO of java to integrate in robotium script. provide the File path as of the path in android device like /system/docs/test1.txt . You can provide the details in a file and push the file to the device using adb push commands. and when the script runs, your parameters will be accessed. I am giving you sample code of robotium test case :