2014-10-28 16 views
5

Varsayılan test çalıştırmasıyla hariç tutulacak yoldaki 'tümleştirme' sözcüğüne sahip olan testleri çalıştırmak istiyorum, ancak bunları ayrı bir görevde birlikte çalıştırmak istiyorum. AS de gradle senkronizasyon yapılırkenAyrı birleştirme testi görevi, android ile bir araya getirme

sourceSets { 
    androidTest.setRoot('src/test') 

    integrationTest.setRoot('src/test') 
} 

... 

androidTestCompile 'junit:junit:4.11' 
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.1' 
androidTestCompile files('libs/android-junit-report-1.5.8.jar') 
androidTestCompile 'com.squareup:fest-android:1.0.8' 
androidTestCompile 'org.robolectric:robolectric:2.3' 

integrationTestCompile 'junit:junit:4.11' 
integrationTestCompile 'com.jayway.android.robotium:robotium-solo:5.1' 
integrationTestCompile files('libs/android-junit-report-1.5.8.jar') 
integrationTestCompile 'com.squareup:fest-android:1.0.8' 
integrationTestCompile 'org.robolectric:robolectric:2.3' 

... 

androidTest { 
    include '**/*Test.class' 
    exclude '**/espresso/**/*.class' 
    exclude '**/integration/**' 
} 

task integrationTest(type: Test) { 
    include '**/integration/**' 
} 

Bu hataya neden oluyor: Şu anda bir temel test yapılandırmasına sahip

Warning: project ':ProjectName': Unable to resolve all content root directories 
Details: java.lang.NullPointerException: null 

ama integrationTest görevi kaldırmak eğer oluşmaz. Ayrıca görev varken ben 'integrationTest' görevi çalıştırmak mümkün ama bu başka bir hata neden olur:

Error:Could not determine the dependencies of task ':ProjectName:integrationTest'. 
A base directory must be specified in the task or via a method argument! 

cevap

1

Tamamen açık değildir, ancak bu hata görev tanımında testClassesDir tanımlayarak değil kaynaklanır. benzer

task integrationTest(type: Test) { 
    include '**/integration/**' 
    testClassesDir = file('build/intermediates/classes') 
} 

şey Java eklentisi için Gradle User Guide açıklanan, ancak tamamen Android eklentisine çevirmez. Henüz tüm detayları incelemedim, ancak bu cevabı çözdüğümde güncelleyeceğim.

İlgili konular