簡體   English   中英

黃瓜功能文件按順序運行

[英]cucumber feature file to run in order

問題:我需要運行我的黃瓜.feature文件以我定義的順序執行,而不是以默認順序(即文件夾結構)運行。

我正在運行使用Cucumber .features文件構建的Android本機應用程序Appium。 在Windows計算機上,在實際設備上運行。

現在我的Runcuckes文件如下所示:

package runner;

import org.junit.runner.RunWith;
import org.testng.annotations.Test;

 import cucumber.api.CucumberOptions;
 import cucumber.api.junit.Cucumber;
 import cucumber.api.testng.AbstractTestNGCucumberTests;

 //@RunWith(Cucumber.class)

 @CucumberOptions(features = { "src/test/java/features" }, 
             glue = { "Steps" }, 
             monochrome = true, 
             tags = {  "@CustomerInsightsSurveyPopupGiveFeedback,"
                     + "@TestAccountSceanrios"
                     + "@ShortlistPage,"
                     + "@SavedSearchesPage,"
                     + "@SearchResultPage,"
                     + "@Short,"
                     + "@SuggestedSearch" })

        // public class RunCucke {
         public class RunCucke extends AbstractTestNGCucumberTests {
           }

按順序運行功能或方案很容易出錯。

在所有測試中,將一個測試鏈接到另一個測試就是一種反模式。 它使您的測試易碎且難以調試。 每個測試應獨立於其他測試。

在Cucumber中,您可以使用Givens設置方案的狀態。 什么時候真正要做某事。 然后檢查您的結果。 給定的方案給定的方案應包括設置應用程序所需的所有內容,以便您可以進行操作。

Cucumber鼓勵您以隨機順序運行方案,並重置每個方案之間的幾乎所有內容。 不要為此而努力,如果這樣做,會使事情變得更加困難。

例如:如果這是您非常基本的功能文件...

 Scenario: Verify View and Write Rewiev is visible Given I am on AbanteCart Home Page When I hover over the "SKIN CARE" option Then I click on the "SUN" option Then I should see the "Flash Bronzer Body Gel" When I hover over ont the Image Then I "View and Write Rewiev" option shoulde be visible 

..您需要在PACKAGE EXPLORER中右鍵單擊該功能文件,或者在文件內單擊鼠標右鍵,然后選擇“以CUCUMBER FEATURE運行”。

它將為您提供可以實施的缺少的方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM