在Intellij中覆盖Spring Boot测试

问题描述 投票:0回答:2

我在Intellij有一个带有maven pom的spring boot 2项目

我认为maven使用不同的内部覆盖工具与jacoco或类似的东西相比

如果我单击 - 使用coverage运行测试中的所有功能

我明白了

Error: Could not find or load main class cucumber.api.cli.Main

如果我添加黄瓜依赖(我没有基于黄瓜的测试或想要它)

Exception in thread "main" cucumber.runtime.CucumberException:
No backends were found. Please make sure you have a 
backend module on your CLASSPATH.

我只想用覆盖范围进行简单的基于弹簧引导休息的测试

我需要什么设置?

编辑:

我有

Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter

我需要这个在pom

<dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.2</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.2</version>
    </dependency>

并安装了java插件所需的黄瓜

现在一切都运行,没有错误

但没有代码覆盖率,它是空白的

spring-boot intellij-idea code-coverage
2个回答
1
投票

这是一个已知的问题,JUnit不是从项目根目录的上下文菜单中建议的:qazxsw poi


0
投票

您似乎已在IDEA中安装了Cucumber集成。这会添加在项目根目录中运行所有要素文件的选项。如果要运行JUnit测试,则必须深入查看https://youtrack.jetbrains.com/issue/IDEA-198762并选择“运行所有测试”。

© www.soinside.com 2019 - 2024. All rights reserved.