문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 마지막 판 양쪽 다음 판 | ||
gradle:testfixtures [2022/04/14 14:55] kwon37xi 만듦 |
gradle:testfixtures [2022/04/14 15:17] kwon37xi [상위 모듈 설정] |
||
---|---|---|---|
줄 3: | 줄 3: | ||
* Multiple Module 프로젝트에서 상위 모듈의 테스트에서 만든 클래스나 리소스를 하위 모듈에서는 원칙적으로 사용할 수 없다. | * Multiple Module 프로젝트에서 상위 모듈의 테스트에서 만든 클래스나 리소스를 하위 모듈에서는 원칙적으로 사용할 수 없다. | ||
* 이를 극복하기 위해 상위 모듈에 '' | * 이를 극복하기 위해 상위 모듈에 '' | ||
- | | + | |
+ | ===== 상위 모듈 설정 ===== | ||
+ | | ||
+ | <code groovy> | ||
+ | plugins { | ||
+ | // which produces test fixtures | ||
+ | id ' | ||
+ | } | ||
+ | |||
+ | // 상위 모듈 의존성 | ||
+ | dependencies { | ||
+ | testImplementation ' | ||
+ | |||
+ | // API dependencies are visible to consumers when building | ||
+ | testFixturesApi ' | ||
+ | |||
+ | // Implementation dependencies are not leaked to consumers when building | ||
+ | testFixturesImplementation ' | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 하위 모듈에서 사용 ===== | ||
+ | <code groovy> | ||
+ | dependencies { | ||
+ | implementation(project(": | ||
+ | |||
+ | testImplementation ' | ||
+ | testImplementation(testFixtures(project(": | ||
+ | } | ||
+ | </ | ||