Eclipseでキュウリ機能ファイルを実行しようとしていますが、次のエラーが発生します。「エラー:メインクラスcucumber.api.cli.Mainが見つからないかロードできませんでした」
Gradleコード(build.gradle)
apply plugin: 'java'
configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
}
}
}
dependencies {
testCompile 'io.cucumber:cucumber-java:3.0.2'
testCompile 'io.cucumber:cucumber-junit:3.0.2'
testCompile 'junit:junit:4.12'
}
repositories {
mavenCentral()
}
機能ファイル(add.Feature)
@tag
Feature: Title of your feature
I want to use this template for my feature file
@tag1
Scenario: Title of your scenario
Given I have the calculator
When I enter input1 and input2
And I press add button
Then I get output
機能ファイルを右クリックしています。次に、実行を選択し、キュウリ機能を押します。前もって感謝します。
ランナークラスを追加するのを忘れました。以下は、ランナークラスのコードです。このクラスを追加した後、機能ファイルを実行できるようになりました
runcukestest.java
package cucumber;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty"})
public class runcukestest {
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加