我已經在 java 中設置了一個黃瓜項目,在我的 Eclipse IDE 中我可以直接運行我的功能文件并且測試將完成。但是,當我將它們作為 JUnit 測試運行時,它們不會運行,在控制臺中它們顯示為@When("^user navigates to Login Page$")public void user_navigates_to_Login_Page() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new PendingException();}如果我雙擊 JUnit 選項卡中的步驟,我會收到以下消息“在選定的項目中找不到測試類”我的測試運行類看起來像這樣,package com.bsautoweb.runner;import java.io.File;import org.junit.AfterClass;import org.junit.runner.RunWith;import com.cucumber.listener.Reporter;import cucumber.api.CucumberOptions;import cucumber.api.junit.Cucumber;@RunWith(Cucumber.class)@CucumberOptions(glue = {"src/test/java/com/bsautoweb/stepdefinitions"}, features = {"src/test/resources/features/"},plugin = "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html",monochrome = true)public class Testrunner { @AfterClass public static void writeExtentReport() { Reporter.loadXMLConfig(new File("config/report.xml")); }}我的文件夾結構如下所示JUnit 似乎忽略了我的粘合代碼。即使我輸入無效路徑,它也不會抱怨。
2 回答

炎炎設計
TA貢獻1808條經驗 獲得超4個贊
將glue選項設置為com/bsautoweb/stepdefinitions
或java包樣式com.bsautoweb.stepdefinitions
添加回答
舉報
0/150
提交
取消