简体   繁体   English

使用Robotium作为Android Project的简介/演示文稿

[英]Use Robotium as intro/demo presentation for Android Project

I have an Android project in Android Studio. 我在Android Studio中有一个Android项目。 As part of this app, I'd like to include a demo, which automatically clicks things, like buttons, type text in EditTexts , swipe left and right, just to show the possibilities within the app. 作为该应用程序的一部分,我想包含一个演示,该演示会自动单击按钮之类的东西,在EditTexts键入文本,左右滑动,以显示该应用程序中的功能。 I made a script with Robotium , and it works just fine, but, I can only start it from within Android Studio. 我使用Robotium编写了一个脚本,效果很好,但是,只能从Android Studio中启动它。 However, I would now like to include that script in the app. 但是,我现在想在应用程序中包含该脚本。 I added the dependencies to build.gradle 我将依赖项添加到build.gradle

dependencies {
    compile 'com.jayway.android.robotium:robotium-solo:5.5.4'
    compile 'junit:junit:4.12'
}

And the demo script, just like any ordinary Android JUnit test: 和演示脚本一样,就像任何普通的Android JUnit测试一样:

public class Demo extends ActivityInstrumentationTestCase2<MainActivity> {
    private Solo solo;

    public TestApk() {
        super(MainActivity.class);
    }

    @Before
    public void setUp() throws Exception {
        this.solo = new Solo(getInstrumentation(), getActivity());
    }

    @Test
    public void test() throws Exception {
        //run demo script
    }

    @After
    public void tearDown() throws Exception {}
}

But it keeps throwing NoClassDefFoundError whenever I call new Demo() . 但是,每当我调用new Demo()时,它总是抛出NoClassDefFoundError

How can I include an Android JUnit test script as part of a regular app/APK? 如何将Android JUnit测试脚本作为常规应用程序/ APK的一部分包含在内?

Or is there a commonly used method to run a demo that I am unaware of? 还是有一种我不知道的运行演示的常用方法?

Robotium is a test framework build exactly for testing, not to provide user fine app intro. Robotium是一个完全用于测试的测试框架,并不是为了向用户提供良好的应用介绍。

If you want make an introduction to your app's user check how to create beatiful and functional intro. 如果您想向您的应用程序用户做一个介绍,请查看如何创建美观且实用的介绍。 You can use for this purpose great libraries like 为此,您可以使用出色的库,例如

You can also creat your new brand one using: 您还可以使用以下方法创建新品牌:

Check apps like Todoist , Udacity , Gmail and more to check how they provide user an introduction. 检查TodoistUdacityGmail等应用程序,以查看它们如何为用户提供介绍。

If you want to show a user specific action or view, try to use: https://github.com/iammert/MaterialIntroView 如果要显示用户特定的操作或视图,请尝试使用: https : //github.com/iammert/MaterialIntroView

Check how Evernote already provides user this purpose. 检查Evernote如何已经为用户提供此目的。

Hope it will help 希望对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM