执行 JUnit 运行器类时没有可用的任务 [英] No tasks available when executing JUnit runner class
本文介绍了执行 JUnit 运行器类时没有可用的任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 IntelliJ 中运行 Cucumber 功能文件.
I am trying to run Cucumber feature files in IntelliJ.
Cucumber Options 指向正确的文件夹,但我在尝试执行 JUnit 运行器类时收到无可用任务"通知.
Cucumber Options is pointing to the right folder, but I get the "No tasks available" notification when trying to execute the JUnit runner class.
我做错了什么?
这是我的 build.gradle
:
plugins {
id 'java'
}
sourceCompatibility = 1.8
apply plugin: 'java'
repositories {
mavenCentral()
}
compileJava.options.encoding = "UTF-8"
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.11'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'io.cucumber:cucumber-java:4.7.1'
compile 'org.seleniumhq.selenium:selenium-server:2.44.0'
testImplementation 'io.cucumber:cucumber-java:4.7.1'
compile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
compile group: 'io.cucumber', name: 'cucumber-java', version: '4.7.1'
compile group: 'io.cucumber', name: 'cucumber-junit', version: '4.7.1'
compile group: 'io.cucumber', name: 'cucumber-core', version: '4.7.1'
compile group: 'net.masterthought', name: 'cucumber-reporting', version: '3.20.0'
compile group: 'io.cucumber', name: 'gherkin', version: '5.1.0'
compile group: 'info.cukes', name: 'cucumber-picocontainer', version: '1.2.5'
compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.6.0'
}
推荐答案
好的,建议的解决方案都不起作用,但我终于想通了.
Ok, none of the proposed solutions worked, but I finally figured it out.
转到设置>构建、执行、部署 >构建工具 >Gradle
并将 Run tests using:
从 Gradle (Default)
更改为 IntelliJ IDEA
.
Went to Settings > Build, Execution, Deployment > Build Tools > Gradle
and changed Run tests using:
from Gradle (Default)
to IntelliJ IDEA
.
注意:找到解决方案 这里.
Note: found the solution here.
这篇关于执行 JUnit 运行器类时没有可用的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文