为什么Android的测试运行报告"空测试套件"?测试、套件、报告、Android

2023-09-06 07:38:22 作者:青柠之恋

我撞我的头靠在墙上这里试图找出原因的IntelliJ / Android正在申报空测试套件。我有两个的IntelliJ模块(Eclipse中的项目)的一个小项目。单元测试模块有自己的Andr​​oidManifest.xml中,我已经贴在底部。我想运行一个 ActivityUnitTestCase ,因为测试将取决于上下文 -object。

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 ("Projects" in Eclipse). The Unit test module has its own AndroidManifest.xml, which I have pasted at the bottom. I am trying to run an ActivityUnitTestCase, since the tests will be dependent upon the Context-object.

主要模块的封装名称为 nilzor.myapp 。测试模块的pacakge名称是 nilzor.myapp.tests

The package name of the main module is nilzor.myapp. The pacakge name of the test module is nilzor.myapp.tests

为什么不是测试运行检测 testBlah() -method作为测试?

Why is not the test runner detecting the testBlah()-method as a test?

<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="nilzor.myapp.tests"
          android:versionCode="1"
          android:versionName="1.0">
    <!-- We add an application tag here just so that we can indicate that
         this package needs to link against the android.test library,
         which is needed when building test cases. -->
    <application>
        <uses-library android:name="android.test.runner"/>
    </application>
    <!--
    This declares that this application uses the instrumentation test runner targeting
    the package of nilzor.myapp.  To run the tests use the command:
    "adb shell am instrument -w nilzor.myapp.tests/android.test.InstrumentationTestRunner"
    -->
    <instrumentation android:name="android.test.InstrumentationTestRunner"
                     android:targetPackage="nilzor.myapp"
                     android:label="Tests for nilzor.myapp"/>
</manifest>

和这里是我的测试类:;

And here is my test class:;

package nilzor.myapp.tests;

public class NilzorSomeTest<T extends Activity> extends ActivityUnitTestCase<T>{
    public NilzorSomeTest(Class<T> activityClass){
        super(activityClass);
    }

    @SmallTest
    public void testBlah(){
        assertEquals(1,1);
    }
}

我已经阅读了检测基本面的的