我在Eclipse中创建了一个New项目,然后创建了一个新的"Feature“,”“& "Testrunner”。但是,当我悬停在Test类的不同注释上时,我看到了相当多的错误消息。见下文{1至5}
我在互联网上做了很多研究,并在pom.xml文件中添加了一些依赖项,但似乎没有什么效果。
当前,我的pom.xml文件中有以下依赖项
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java --><groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.8.2</version><!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit --><groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.8.2</version>
<scope>test</scope>当我将鼠标悬停在黄瓜上时,我得到以下message
好像要用jre文件做点什么。以下是我尝试过的基于堆栈溢出A中的响应的解决方案:因特网上的一些解决方案建议我在pom.xml文件中添加下面的依赖项,但它没有解决这个问题
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
<type>pom</type>
<scope>test</scope>注意:-即使将这些添加到pom.xml文件中,我也不会在Maven依赖项列表中看到它。
(B)增加进口cucumber.junit.Cucumber;
但即使这样也没有帮助
C]注释掉@RunWith(Cucumber,class)并将以下依赖项添加到pom.xml文件中
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<type>pom</type>
<scope>test</scope>注意:-针对“导入cucumber.api.CucumberOptions”的错误消息消失了,但针对“导入cucumber.api.junit.Cucumber”的错误消息仍然显示。
你好,罗希特
发布于 2020-11-10 04:03:58
我解决了这个问题。
解决方案:-验证Environment是否使用JUNIT4
步骤:
然后
JUNIT出现在Java窗口上。
https://stackoverflow.com/questions/64758032
复制相似问题