NBAndroid Gradle: Run->Test Project fails to run tests

Issue #33 resolved
Rob Smith created an issue

Using Run->Test Project in a NBAndroid Gradle project fails to run any tests. No test results are displayed and no log output is seen from any tests that should be run.

This can be demonstrated by modifying the HelloFlavours project in NBAndroid issue #31.

  1. Comment out the productFlavors block from the build.gradle file
  2. Comment out references to buildFlavour and EFlavour in files MainActivity.java and MainActivityUnitTest.java

Note that tests can be run successfully from the command line using:

gradle installDebug installDebugTest
adb shell am instrument -w com.awayteamsoftware.helloflavours.tests/.MyTestRunner

Log output is seen from the tests (tag HelloFlavours), and the 'ok' result is confirmed by the adb shell command response.

From NetBeans, Run->Test Project produces the following output:

Executing: gradle assembleDebug assembleDebugTest

:compileDebugNdk
:preBuild
:preDebugBuild
:checkDebugManifest
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
:preDexDebug
:dexDebug
:processDebugJavaRes UP-TO-DATE
:validateDebugSigning
:packageDebug
:assembleDebug
:compileDebugTestNdk
:preDebugTestBuild
:prepareDebugTestDependencies
:compileDebugTestAidl
:processDebugTestManifest
:compileDebugTestRenderscript
:generateDebugTestBuildConfig
:mergeDebugTestAssets
:generateDebugTestResValues UP-TO-DATE
:generateDebugTestResources
:mergeDebugTestResources
:processDebugTestResources
:generateDebugTestSources
:compileDebugTestJava
:preDexDebugTest
:dexDebugTest
:processDebugTestJavaRes UP-TO-DATE
:packageDebugTest
:assembleDebugTest

BUILD SUCCESSFUL

Total time: 3.821 secs

No log output is seen from any test, confirming that they are not run, and no test results are displayed.

This bug may block successful verification of issue #31.

Comments (3)

  1. Radim Kubacki

    OK, it seems that the name of test runner should be taken from Gradle model and there is no need for the UI to set it.

  2. Radim Kubacki

    A response to 'However, running tests using the plugin is unreliable, giving spurious failures or no results at all from the IDE, in contrast to the consistent results produced by both adb command line and Android Studio IDE.' from issue #29:

    One source of unreliability is likely the fact that only the test apk is deployed and the tested one is possibly omitted. Can you check that?

    If there are other problems it would be best to create a reproducible test case and file as bugs.

  3. Log in to comment