跳到正文
cccskills
免费在 GitHub 公开

parallelization

Conventions for using parallelization in all tests using Jupiter

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md2.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Add a JUnit properties file to all modules to make sure parallelization is enabled

Filename should be: junit-platform.properties and it should be placed in src/test/resources of each module.

Its content should be:

junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.config.fixed.parallelism = 4
junit.jupiter.execution.parallel.config.dynamic.factor = 4.0
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent

Only add this file, and if the file doesn't exist. Do not override existing files.

Check if tests run successfully for every module where you add this file. If it fails, then remove the file.

In case they fail, the following should be tried

  1. Add @TestMethodOrder(OrderAnnotation::class) to the test class
  2. Add @Execution(SAME_THREAD) to the test methods that are failing
  3. Add @Order(1) to the test methods that are failing. The number should be sequential for all failing tests

Example 1


@SpringBootTest(webEnvironment = RANDOM_PORT)
@TestMethodOrder(OrderAnnotation::class)
class NarwhalsShopControllerTest @Autowired constructor(
    private val narwhalsWebShopDao: NarwhalsWebShopDao,
    private val testRestTemplate: TestRestTemplate,
) {
    val xmlHeaders = HttpHeaders().apply {
        add("Content-Type", APPLICATION_XML_VALUE)
    }
    val jsonHeaders = HttpHeaders().apply {
        add("Content-Type", APPLICATION_JSON_VALUE)
    }

    @Test
    fun `should load narwhals`() {
    }

    @Test
    fun `should make full purchase when stocks are available`() {
    }

    @Test
    @Execution(SAME_THREAD)
    fun `should make multiple purchase request but only one succeeds when stocks are available`(): Unit = runBlocking {
    }

    @Test
    @Execution(SAME_THREAD)
    fun `should make partial purchase when stocks are not available`() {
    }

    @Test
    fun `should make no purchase when stocks are not available and show predictions`() {
    }

    @Test
    @Execution(SAME_THREAD)
    @Order(1)
    fun `should return not found failed when nothing is available`() {
    }

}

If it still fails. Only here revert the changes made to the test class and remove the junit-platform.properties file.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

angular

免费

Conventions for Angular applications

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using annotations in all tests using Jupiter

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

docker

免费

Conventions for docker

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using in all JEE frameworks. These are common standards for CDI

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using in all JVM languages

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using Java

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

查看 jesperancinha 的全部技能

报告此技能的问题