我在 Groovy 中有一个 Cucumber 测试,如下所示
import org.junit.runner.RunWith
import cucumber.junit.Cucumber
import cucumber.junit.Cucumber.Options
@RunWith(Cucumber.class)
@Options(features = ["classpath:CarDrive.feature"])
public class FuelCarTest {
}
import cucumber.annotation.en.Given
import cucumber.annotation.en.Then
import cucumber.annotation.en.When
public class FuelCarSteps {
public FuelCarSteps() {
println "FuelCarSteps::FuelCarSteps"
}
@Given("I have a car")
def givenCar() {
println "I have a car"
}
@When("^you fill it with 50 litres of fuel")
def addFuel() {
println "add fuel"
}
@Then("^the tank contains 60 litres")
def checkBalance() {
println "TODO: add check here"
}
}
我可以使用 mvn test 很好地运行测试,但是当我尝试在 Eclipse 中运行它时,我得到了
No JUnit tests found
尝试清洁、重建和重新启动