找到 11 篇文章 關於 Cucumber

Selenium 和 Cucumber 之間的區別

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

720 次瀏覽

Selenium 和 Cucumber 之間存在一些差異,如下所示 - 序號 Selenium Cucumber 1 它是一個測試自動化框架。它不是一個測試自動化框架。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 次瀏覽

我們可以透過在特性檔案中直接傳遞值,在 Cucumber 中不使用 Examples 進行單一資料引數化。示例特性檔案。特性:Tutorialspoint 工作頁面場景:Tutorialspoint 工作頁面外觀和費用給定啟動站點 https://tutorialspoint.tw/about/about_careers.htm 然後驗證頁面上的選項卡URL 直接傳遞給特性檔案中的 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 中使用正則表示式來選擇特性檔案中的一組類似語句。示例特性檔案特性:考試大綱場景大綱:夏季和冬季考試時間表給定夏季的考試時間表給定數學和物理學大綱給定冬季的考試時間表步驟定義檔案具有 @Given("^Exam time table in ([^\"]*) season$"),它藉助正則表示式將特性檔案中的兩個 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 鉤子來執行前置條件和後置條件測試方法。示例特性檔案。特性:交易表場景:驗證每月交易給定使用者位於付款頁面步驟定義具有帶有鉤子 @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 次瀏覽

我們可以透過在特性檔案中標記場景,在 Cucumber 中從一組測試用例中包含和排除測試方法。示例特性檔案。@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+ 次瀏覽

我們可以藉助特性檔案中場景的標記,在 Cucumber 中跳過特定測試方法的執行。示例特性檔案。@Regression 特性:發票測試@Smoke 場景:登入驗證給定使用者位於主頁@Payment 場景:付款測試給定使用者位於付款頁面特性檔案,其中場景具有標記 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

524 次瀏覽

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

Cucumber的主要檔案元件是什麼?

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

891 次瀏覽

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

廣告

© . All rights reserved.