2014-06-06 3 views
2

나는 2 개의 gradle 프로젝트를 가지고 있습니다 : Android app과 RoboSpock 테스트입니다. 안드로이드 응용 프로그램에 대한전이 의존성을 포함하는 방법

내 build.gradle는

. . . 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile ('com.actionbarsherlock:actionbarsherlock:[email protected]') { 
     exclude module: 'support-v4' 
    } 
} 

. . . 

을 가지고 있으며, 예컨대 assembleRelease 작업, 그 자체로 올바르게 구축합니다.

테스트가 작동하지 않아 막혔습니다. 나는 다음과 같은 오류를 많이 낳는다 :

package com.google.zxing does not exist 

이는 .jar 파일이 선택되지 않은 것 같습니다. 즉, 내가 이적 = true를 추가하고 명시 적으로 jar 파일을 포함 해봤에서 볼 수 있듯이

buildscript { 
    repositories { 
    mavenLocal() 
    mavenCentral() 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.9.+' 
     classpath 'org.robospock:robospock-plugin:0.4.0' 

    } 
} 

repositories { 
    mavenLocal() 
    mavenCentral() 
} 

apply plugin: 'groovy' 

dependencies { 
    compile "org.codehaus.groovy:groovy-all:1.8.6" 
    compile 'org.robospock:robospock:0.4.4' 
} 


dependencies { 
    compile fileTree(dir: ':android:libs', include: '*.jar') 
    compile (project(':estanteApp')) { 
     transitive = true 
    } 
} 

sourceSets.test.java.srcDirs = ['../android/src/', '../android/build/source/r/debug'] 

test { 
    testLogging { 
     lifecycle { 
      exceptionFormat "full" 
     } 
    } 

} 

project.ext { 
    robospock = ":estanteApp" // project to test 
} 


apply plugin: 'robospock' 

:

다음은 테스트 프로젝트에 대한 내 build.gradle입니다. 하지만 내가 뭘하려고하든, 나는 패키지가 존재하지 않는 오류로 끝난다.

답변

0

Android Studio에서는 테스트를 위해 더 이상 다른 프로젝트가 필요하지 않습니다. 은 "defaultConfig"에

그런 다음 "build.gradle"에 다음을 추가 "SRC/androidTest/자바"에서 동일한 모듈에 테스트 코드를 넣어

testPackageName "com.yourpackage.test" 
testInstrumentationRunner "android.test.InstrumentationTestRunner" 
testFunctionalTest true 
+0

대신 에뮬레이터에서 실행되는 테스트하지 않을까요 JVM의? –

관련 문제