Why is the Android test runner reporting “Empty test suite”?

前端 未结 30 2034
有刺的猬
有刺的猬 2020-11-28 07:59

I am banging my head against the wall here trying to figure out why IntelliJ/Android is reporting \"Empty test suite\". I have a small project with two IntelliJ Modules (\"

相关标签:
30条回答
  • 2020-11-28 08:25

    I had a similar issue. Not sure why this is occurring but I was able to fix it by going to: "File" > "Invalidate Caches/Restart" in Android Studio.

    0 讨论(0)
  • 2020-11-28 08:27

    After facing the problem today - not being able to run the instrumented android tests with Empty suite error - I found a git issue about this problem and thanks to Stephan Linzner, I could run the tests.

    tl;dr You have to right click the test package and not the class in order to make the tests run.

    Reference: https://github.com/googlecodelabs/android-testing/issues/27#issuecomment-219074863

    0 讨论(0)
  • 2020-11-28 08:28

    If this is happening "all of a sudden" or "it was working 5 minutes ago" my solution was to go into Run/Debug configurations and remove any configurations under "Android Tests". Sometimes these configurations get corrupted if I refactor the class under test (for example by moving to an new package).

    0 讨论(0)
  • 2020-11-28 08:28

    I had the same issue on Android Studio 2.3.1, turns out it was just a bug with AS. Running the same test on version 2.2.1 performs fine.

    If you're only running Android Studio on the Cannary channel, I recommend you also install a stable version as well. http://tools.android.com/tips/using-multiple-android-studio-versions

    0 讨论(0)
  • 2020-11-28 08:30

    The test class may excluded from the compilation. Fix it in setting-compiler-exclude.

    0 讨论(0)
  • 2020-11-28 08:31

    For Intellij 15 I resolved this issue by:

    1. Opening the 'Project Structure' settings
    2. Clicking 'Modules' (on left)
    3. 'Sources' Tab
      a. Right click on your source directory (usually src) click 'Source'.
      b. Right click on your test directory click 'Test'
      c. Right click on your out directory click 'Excluded'
    4. Go to 'Paths' tab
      a. Click 'Use module compile output path' radio button
      b. Select your output path directory for 'Output Path'
      c. Select your test path directory for 'Test output Path'
    5. Click Ok
    0 讨论(0)
提交回复
热议问题