亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Cucumber JUnit 測試未將功能粘合到步驟定義

Cucumber JUnit 測試未將功能粘合到步驟定義

30秒到達戰場 2023-07-13 15:50:25
我已經在 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



查看完整回答
反對 回復 2023-07-13
?
慕運維8079593

TA貢獻1876條經驗 獲得超5個贊

給glue =“com.bsautoweb.stepdefinitions”



查看完整回答
反對 回復 2023-07-13
  • 2 回答
  • 0 關注
  • 143 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號