'android.support.test.espresso does not exist' when I want to use it to individual apk test

前端 未结 6 1303
-上瘾入骨i
-上瘾入骨i 2021-02-03 12:09

I need to do some auto testing jobs to an Android application without its source code. I found both robotium and espresso can do this job, I decided to use espresso because its

6条回答
  •  悲&欢浪女
    2021-02-03 12:36

    I didn't clearly understand what did you mean under

    ... Android application without its source code.

    but why can't you call activity from the test class without reflection? Just how it was shown in Espresso Start Guide.

    You have activity and appropriate test, take a look at the package, imported classes, extended class and constructor in those examples. I mean smth like this:

    package com.google.android.apps.common.testing.ui.espresso.tests;
    
    import static com.google.android.apps.common.testing.ui.espresso.Espresso.onData;
    <...>
    
    import com.google.android.apps.common.testing.ui.testapp.R;
    import com.google.android.apps.common.testing.ui.testapp.SimpleActivity;
    
    import android.test.ActivityInstrumentationTestCase2;
    import android.test.suitebuilder.annotation.LargeTest;
    
    @LargeTest
    public class BasicTest extends ActivityInstrumentationTestCase2 {
    
      public BasicTest() {
        super(SimpleActivity.class);
      }
    
      @Override
      public void setUp() throws Exception {
        super.setUp();
        getActivity();
      }
    
      <...>
    

提交回复
热议问题