找到 11 篇文章 關於 Cucumber

Selenium 和 Cucumber 之間的區別

Debomita Bhattacharjee
更新於 2021年4月7日 09:13:10

719 次瀏覽

Selenium 和 Cucumber 之間存在以下區別:序號SeleniumCucumber1它是一個測試自動化框架。它不是一個測試自動化框架。2主要用於前端應用程式的自動化測試。主要用作行為驅動開發的工具。3可以用任何程式語言編寫,如 Java、Python、Ruby、C# 等。可以用 Gherkin 語言編寫。4用 Java 開發。用 Ruby 開發。5只有具備技術知識的使用者才能使用。即使沒有技術知識的使用者也可以使用。6與 Cucumber 相比,可讀性較差。易於閱讀。7與 Cucumber 相比,安裝過程冗長且複雜。安裝簡單。8可以包含條件語句。不能包含條件語句。9語法 ... 閱讀更多

如何在 Cucumber 中不使用 Examples 進行單個數據引數化?

Debomita Bhattacharjee
更新於 2020年6月11日 13:20:17

305 次瀏覽

我們可以透過在 feature 檔案中直接傳遞值來在 Cucumber 中不使用 Examples 進行單個數據引數化。示例Feature 檔案。功能:Tutorialspoint 工作頁面場景:Tutorialspoint 工作頁面外觀和費用給定啟動站點 https://tutorialspoint.tw/about/about_careers.htm 然後驗證頁面上的選項卡URL 直接傳遞在 feature 檔案的 Given 語句中。步驟定義檔案應具有 Given 語句的對映。示例@Given (“^Launch site \"([^\"]*)\"$”) public void launchJobsite(String url){    System.out.println("url is : " + url); } @Then (“^Verify the tabs on the page"$”) public void tabverification(){    System.out.println("Tabs verified successfully); }@Given (“^Launch site \"([^\"]*)\"$”) 傳遞 UR ... 閱讀更多

Cucumber 中的 glue 是什麼意思?

Debomita Bhattacharjee
更新於 2020年6月11日 13:19:23

7K+ 次瀏覽

glue 是 Cucumber 選項的一部分,它描述了步驟定義檔案的位置和路徑。示例測試執行器檔案。import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @CucumberOptions(    features = "src/test/java/features",    glue="stepDefinations" ) public class TestRunner extends AbstractTestNGCucumberTests { }

如何在 Cucumber 中使用正則表示式?

Debomita Bhattacharjee
更新於 2020年6月11日 13:16:57

4K+ 次瀏覽

我們可以在 Cucumber 中使用正則表示式來選擇 feature 檔案中一系列類似的語句。示例feature 檔案功能:考試大綱場景大綱:夏季和冬季考試時間表給定夏季考試時間表給定數學和物理大綱給定冬季考試時間表步驟定義檔案具有 @Given("^Exam time table in ([^\"]*) season$"),它藉助正則表示式將 feature 檔案中的兩個 Given 語句對映起來。示例@Given ("^Exam time table in ([^\"]*) season$") public void timeTable(String season){    if (season.equals("winter")){       System.out.println("The winter syllabus");    }else{       System.out.println("The summer syllabus");   ... 閱讀更多

如何在 Cucumber 中執行前置條件和後置條件測試方法?

Debomita Bhattacharjee
更新於 2020年6月11日 13:13:43

2K+ 次瀏覽

我們可以藉助 Cucumber 中的 @Before 和 @After 鉤子來執行前置條件和後置條件測試方法。示例Feature 檔案。功能:交易表場景:驗證月度交易給定使用者在付款頁面步驟定義具有 @Before 和 @After 鉤子的方法。帶有 @Before 鉤子的測試方法將作為前置條件執行,然後測試方法(naviagteToPayment() 方法)將執行,最後帶有 @After 鉤子的測試方法(即後置條件)將執行。示例@Before public void method1(){    System.out.println("The precondition executed successfully"); } @After public void method2(){    System.out.println("The postcondition executed successfully "); } @Given ("^User is on payment ... 閱讀更多

如何在 Cucumber 中從一組測試用例中包含和排除測試方法?

Debomita Bhattacharjee
更新於 2020年6月11日 13:12:05

545 次瀏覽

我們可以透過在 feature 檔案中標記場景來從 Cucumber 中的一組測試用例中包含和排除測試方法。示例Feature 檔案。@Tutorialspoint 測試功能:登入功能測試@Smoke 場景:主頁測試給定使用者位於主頁@CodingModule 場景:編碼模組測試給定使用者位於編碼模組頁面測試執行器檔案具有要排除的標籤 Smoke 和要包含在執行中的標籤 CodingModule。示例import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions(    features = “src/test/java/features”,    glue = “stepDefiniations”    tags = {“~@Smoke”, “@CodingModule”} )閱讀更多

如何在 Cucumber 中跳過特定測試方法的執行?

Debomita Bhattacharjee
更新於 2020年6月11日 13:10:21

5K+ 次瀏覽

我們可以藉助 feature 檔案中場景的標記來跳過 Cucumber 中特定測試方法的執行。示例feature 檔案。@Regression 功能:發票測試@Smoke 場景:登入驗證給定使用者位於主頁@Payment 場景:付款測試給定使用者位於付款頁面Feature 檔案,其中包含具有 Smoke 和 Payment 標籤的場景。示例import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions(    features = “src/test/java/features”,    glue = “stepDefiniations”    tags = { “~@Payment”} )要跳過帶有 @Payment 的場景,在測試執行器檔案中,@Payment 標籤前放置 ~。閱讀更多

如何在 Cucumber 中設定測試方法的執行順序?

Debomita Bhattacharjee
更新於 2020年6月11日 13:07:55

5K+ 次瀏覽

我們可以藉助 order 關鍵字來設定 Cucumber 中測試方法的執行順序。測試方法在步驟定義檔案中分配了順序。順序較低的測試方法首先執行,然後是順序較高的測試方法。示例步驟定義檔案。@Before (order = 1) public void login(){    System.out.println("login is successful"); } @Before (order = 2) public void payment(){    System.out.println("payment is successful"); } @Given ("^Land in repayment page$") public void repay(){    System.out.println ("Actual Scenario of repayment"); }順序較低的測試方法(login() 設定為 1)將首先執行。然後是 payment () 測試方法 ... 閱讀更多

Cucumber 中的 Scenario Outline 是什麼意思?

Debomita Bhattacharjee
更新於 2020年6月11日 13:06:11

523 次瀏覽

我們在 Cucumber 的 feature 檔案中使用 Scenario Outline 關鍵字。如果需要使用多個組合中的多個數據集執行特定場景,則使用 Scenario Outline。多個數據集以表格形式表示,在 Examples 關鍵字下用 (||) 符號分隔。每一行表示一組資料。示例Feature 檔案。功能:登入驗證功能場景大綱:登入驗證給定使用者登入主頁當頁面標題為 Tutorialspoint 然後使用者鍵入 "" 和 "" 示例:| 使用者名稱 | 密碼 | | Selenium | t123 ... 閱讀更多

Cucumber 中的主要檔案元件有哪些?

Debomita Bhattacharjee
更新於 2020年6月11日 13:04:56

889 次瀏覽

Cucumber 中的主要檔案元件如下所示:Feature 檔案 - 此副檔名為 .feature。它包含純文字中的單個或多個測試場景。所有場景都使用 Then、Given、When、And、But、Feature、Background 等關鍵字編寫。示例Feature 檔案。功能:登入測試場景:Tutorialspoint 登入驗證給定:啟動“https://tutorialspoint.tw/index.htm”步驟定義檔案 - 此副檔名為 .java。它提供了測試場景到測試指令碼邏輯的對映。示例基於上述 feature 檔案的步驟定義檔案。@Given (“^Launch the \"([^\"]*)\"$”) public void launch_application(String url){    System.out.println("The url is ... 閱讀更多

廣告
© . All rights reserved.