Skip to content

Instantly share code, notes, and snippets.

@stephenmac7
Created June 3, 2015 15:34
Show Gist options
  • Save stephenmac7/a40a0536f973393451f1 to your computer and use it in GitHub Desktop.
Save stephenmac7/a40a0536f973393451f1 to your computer and use it in GitHub Desktop.

Revisions

  1. stephenmac7 created this gist Jun 3, 2015.
    30 changes: 30 additions & 0 deletions MainActivityTest.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    package com.example.stephen.myapplication;

    import android.test.ActivityInstrumentationTestCase2;
    import android.test.TouchUtils;
    import android.widget.TextView;

    /**
    * Created by stephen on 15/06/03.
    */
    public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
    private MainActivity activity;
    private TextView hello;

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

    @Override
    protected void setUp() throws Exception {
    super.setUp();
    setActivityInitialTouchMode(true);

    activity = getActivity();
    hello = (TextView) activity.findViewById(R.id.hello_world);
    }

    public void testHelloClick() {
    TouchUtils.clickView(this, hello);
    }
    }