网站建设资讯

NEWS

网站建设资讯

gradle测试用例拆分-创新互联

解决问题

项目在ci阶段,由于整体test耗时较长,因此考虑将test拆分成更小的单元,这样在circleci等平台上通过并发达到缩短耗时的目的。

专业成都网站建设公司,做排名好的好网站,排在同行前面,为您带来客户和效益!创新互联为您提供成都网站建设,五站合一网站设计制作,服务好的网站设计公司,成都网站设计、网站建设负责任的成都网站制作公司!
  1. 在build.xml文件中定义SplitTest,并挂载到tasks graph上
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.*"
    }
}
  1. circleci上并发执行即可
$ gradle testService
$ gradle testOther
问题分析
  1. 分析gradle任务

生成在线版执行计划

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

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


文章题目:gradle测试用例拆分-创新互联
转载来于:http://cdweb.net/article/icdps.html