2
需要使用彈簧配置文件通過gradle運行測試。使用彈簧配置文件運行gradle任務(集成測試)
gradle clean build
我添加了任務:
task beforeTest() {
doLast {
System.setProperty("spring.profiles.active", "DEV")
}
}
test.dependsOn beforeTest
而且我測試的定義是:
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("TestProfile")
public class SomeTest {
但這種結構不適合我的工作。
Gradle運行測試。
謝謝,但它不幫助我 – yazabara