admin管理员组文章数量:1410689
Context
Consider a Junit 5 test suite with a maven-failsafe configuration that is configured to run the tests concurrently in multiple processes using the forkCount
parameter.
Question
Is it possible to programmatically control which forks pick up what test?
Motivation
The performance of the overall test suite can change dramatically based on how tests are distributed across forks. This is especially relevant for Spring-based tests: often one of the slowest parts of a spring-based test is spinning up the application context (AC). Therefore, the Spring TestContext framework caches the AC between tests, but clearly this isn't (can't be) shared between processes. If a parallel test suite uses multiple distinct ACs, then minimizing the distinct number of ACs per process can significantly reduce runtime.
Failed Attempt
One option I've explored is to use test suites. We can configure failsafe to fork based on test suite, and then manually group the tests in appropriate suites. This is however less than ideal, because it relies on manual (thus unreliable) assignment of tests to suites, and because it strictly pins a suite to a fork (which can leave other forks idle when suites aren't approximately the same size).
本文标签:
版权声明:本文标题:java - How to control assignment of tests to processes with Junit5 and maven-failsafe in forked execution mode? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744809128a2626330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论