简体   繁体   中英

Use Robotium as intro/demo presentation for Android Project

I have an Android project in Android Studio. 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. I made a script with Robotium , and it works just fine, but, I can only start it from within Android Studio. However, I would now like to include that script in the app. I added the dependencies to 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:

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() .

How can I include an Android JUnit test script as part of a regular app/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.

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.

If you want to show a user specific action or view, try to use: https://github.com/iammert/MaterialIntroView

Check how Evernote already provides user this purpose.

Hope it will help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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