項(xiàng)目在ci階段,由于整體test耗時(shí)較長(zhǎng),因此考慮將test拆分成更小的單元,這樣在circleci等平臺(tái)上通過(guò)并發(fā)達(dá)到縮短耗時(shí)的目的。
abstract class SplitTest extends Test {SplitTest(){group = 'splitTest'
useJUnitPlatform()
maxHeapSize '4g'
jvmArgs '-XX:MaxMetaspaceSize=1g'
doLast{println("haha:"+reports.html.destination.absolutePath)
}
}
}
tasks.register('testConverter', SplitTest) {description = 'Runs controller tests'
filter{includeTestsMatching "com.xx.reward.ops.converter.*"
}
}
tasks.register('testController', SplitTest) {description = 'Runs controller tests'
filter{includeTestsMatching "com.xx.reward.ops.controller.*"
}
}
tasks.register('testService', SplitTest) {description = 'Runs service tests'
filter{includeTestsMatching "com.xx.reward.ops.service.*"
}
}
tasks.register('testOther', SplitTest) {description = 'Runs other tests'
filter{excludeTestsMatching "com.xx.reward.ops.controller.*"
excludeTestsMatching "com.xx.reward.ops.service.*"
}
}
$ gradle testService
$ gradle testOther
問(wèn)題分析生成在線版執(zhí)行計(jì)劃
gradle build --scan
本地版本
gradle --profile
參考:
Using additional test types Sample
Developing Custom Gradle Task Types
Inspecting Gradle Builds
Improve the Performance of Gradle Builds
test filter api
Testing in Java & JVM projects
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧