사용자 도구

사이트 도구


gradle:testfixtures

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
gradle:testfixtures [2022/04/14 14:55]
kwon37xi
gradle:testfixtures [2022/04/15 09:57] (현재)
kwon37xi [상위 모듈 설정]
줄 4: 줄 4:
   * 이를 극복하기 위해 상위 모듈에 ''testFixtures''라는 소스 디렉토리를 추가하고 해당 디렉토리를 하위 모듈에서 테스트로 의존성을 걸게 하면 상위 모듈, 하위 모듈 모두에서 사용가능해진다.   * 이를 극복하기 위해 상위 모듈에 ''testFixtures''라는 소스 디렉토리를 추가하고 해당 디렉토리를 하위 모듈에서 테스트로 의존성을 걸게 하면 상위 모듈, 하위 모듈 모두에서 사용가능해진다.
  
-===== 설정 =====+===== 상위 모듈 설정 ===== 
 +  * 설정 후 ''module/src/testFixtures/{java/resources}'' 소스 루트에 테스트 픽스처 소스 코드나 리소스를 둔다.
 <code groovy> <code groovy>
 plugins { plugins {
     // which produces test fixtures     // which produces test fixtures
     id 'java-test-fixtures'     id 'java-test-fixtures'
 +}
  
 +// 상위 모듈 의존성
 +dependencies {
 +    testImplementation 'junit:junit:4.13'
 +
 +    // testFixtures 에 어떤 의존성이 필요할 경우 추가
 +    // API dependencies are visible to consumers when building
 +    testFixturesApi 'org.apache.commons:commons-lang3:3.9'
 +    // Implementation dependencies are not leaked to consumers when building
 +    testFixturesImplementation 'org.apache.commons:commons-text:1.6'
 } }
 </code> </code>
 +
 +===== 하위 모듈에서 사용 =====
 +<code groovy>
 +dependencies {
 +    implementation(project(":상위모듈"))
 +
 +    testImplementation 'junit:junit:4.13'
 +    testImplementation(testFixtures(project(":상위모듈")))
 +}
 +</code>
 +
gradle/testfixtures.1649915757.txt.gz · 마지막으로 수정됨: 2022/04/14 14:55 저자 kwon37xi