1. Are you ready for the Galaxy S20? Here is everything we know so far!

Gradle testOptions not working

Discussion in 'Android Development' started by mcpixel, Aug 15, 2019.

  1. mcpixel

    mcpixel Newbie
    Thread Starter

    My build.grandle:
    Code (Text):
    1. apply plugin: 'com.android.application'
    2.  
    3. android {
    4.     compileSdkVersion 29
    5.     buildToolsVersion "29.0.1"
    6.     defaultConfig {
    7.         applicationId "com.example.app5"
    8.         testApplicationId "com.example.app5.test"
    9.         minSdkVersion 16
    10.         targetSdkVersion 29
    11.         versionCode 1
    12.         versionName "1.0"
    13.         testInstrumentationRunner "android.test.InstrumentationTestRunner"
    14.         testHandleProfiling true
    15.         testFunctionalTest true
    16.     }
    17.     testBuildType "debug"
    18.     testOptions {
    19.         reportDir "$rootDir/test-reports"
    20.         resultsDir "$rootDir/test-results"
    21.         unitTests {
    22.             returnDefaultValues true
    23.             all {
    24.                 jvmArgs '-XX:MaxPermSize=256m'
    25.                 if(it.name == 'testDebugUnitTest')
    26.                     systemProperty 'debug', 'true'
    27.             }
    28.         }
    29.     }
    30.     buildTypes {
    31.         release {
    32.             minifyEnabled false
    33.             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    34.         }
    35.     }
    36. }
    37.  
    38. dependencies {
    39.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    40.     implementation 'androidx.appcompat:appcompat:1.0.2'
    41.     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    42.     testImplementation 'junit:junit:4.12'
    43.     androidTestImplementation 'androidx.test:runner:1.2.0'
    44.     androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    45. }
    46.  
    I specified reportDir. but when I run the unit test, I don’t see anything in the project folder in the test-results folder, that is, this option does not work, it seems to have to save the results to that folder automatically, and it seems the whole testOptions block does not work. What could be the problem ?
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Gradle testOptions working
  1. Dan Coleman
    Replies:
    0
    Views:
    270
  2. Pravinkumar Putta
    Replies:
    2
    Views:
    911
  3. RebelCommander
    Replies:
    0
    Views:
    741
  4. Pei Liu
    Replies:
    1
    Views:
    1,132
  5. Sathish Mohan
    Replies:
    0
    Views:
    330
  6. kannanthayumanavan
    Replies:
    5
    Views:
    1,769
  7. Mekhi Greene
    Replies:
    3
    Views:
    607
  8. ClintonBrits
    Replies:
    1
    Views:
    459
  9. mcpixel
    Replies:
    2
    Views:
    959
  10. jamesmark147
    Replies:
    3
    Views:
    1,130

Share This Page

Loading...