Test events were not received - Android Studio

后端 未结 5 1770
长情又很酷
长情又很酷 2021-01-07 18:35

I have no idea how to test and I was following a tutorial.I am trying to run:

package name.company.sunshine.app.data;

import android.test.AndroidTestCase;
         


        
相关标签:
5条回答
  • 2021-01-07 19:05

    I am doing the course too and ended up with the same problem.

    After an hour of tinkering I think I found the solution.

    Don't try to run the the test cases from the whole package as they did in the video; you have to run it from a single class and choose the AndroidTest option. It does not work with the Gradle option.

    See picture attached.

    0 讨论(0)
  • 2021-01-07 19:12

    I was able to get past this problem after making two changes.

    uncheck use in-process build in Settings -> Build Tools -> Compiler Source: https://code.google.com/p/android/issues/detail?id=172162

    force Gradle to re-run all tasks by updating your run configurations. Add --rerun-tasks to the Script Parameters.

    Source: https://www.bignerdranch.com/blog/triumph-android-studio-1-2-sneaks-in-full-testing-support/

    0 讨论(0)
  • 2021-01-07 19:12

    just as Matt Accola sayd, if you already selected the gradle option and cant find that sub menu in his answer, u will need to go to run >> Edit Configuration... and then under the Gradle sub menu, delete the items (TestPractice & others if existed) and then re do the test by selecting the AnroidTest.

    0 讨论(0)
  • 2021-01-07 19:18

    This solution is tested in android studio 1.5.1

    If you have problem with tests in android studio because use in-process build disappeared, include the following:

    <project-folder>
    |-- .idea
        |-- workspace.xml
    

    Just add the following component at the very top, just inside the project tag:

    <project version="4">
      <component name="AndroidGradleBuildConfiguration">
        <option name="USE_EXPERIMENTAL_FASTER_BUILD" value="false" />
      </component>
      ...
    
    </project>
    
    0 讨论(0)
  • 2021-01-07 19:25

    When you run your test select the Android Test option.

    Screen Shot

    The JUnit and Gradle options should not be used for this type of test.

    0 讨论(0)
提交回复
热议问题