2016-12-09 167 views
0

我有如下的黃瓜功能。我希望背景只能執行一次,而不是針對示例中的每一行。我怎麼做。在黃瓜只能執行一次的背景

特點:通過UI

Background: Bulk import of portfolios and treaties 
    Given the user logs into 「dev」 environment as 「User 」 with password "Password1" 
    And the user Chooses to import a portfolio providing SQLServer as "10.10.10.10」 
    And the user chooses uploaded Anytime 
    And the user enters the filter criteria for 「Client_EDM」 
    And the user expands the Edm 
    And the user expands the portfolios dropdown 
    And the user chooses the Name as "UK COM for v0.7" 
    And the user chooses the contract as "" 

    Scenario Outline: Import of portfolio 
    Given the user clicks on Import button 
    And the user specifies the ImportJobName as "<ImportName>" 
    And the user specifies the project "<EDM>" 
    And the user specifies the structure "<StructureName>" 
    And the user submits a portfolio for Import 
    Examples: 
     | EDM    | ImportName   | StructureName| 
     |Client1_EDM|EUFL_UK_Com_Import100|EUFLCom_Import101| 
     |Client2_EDM|EUFL_UK_Com_Import101|EUFLCom_Import101| 

標記的方案大綱爲@attribute或添加@Before每個背景步驟不會解決我的問題..組合的批量導入如何去任何建議關於做這件事。?

+0

整個背景的想法是每次執行每個場景。將這些步驟分成另一個文件並首先執行它可能是有意義的?或者,也許你想在你的測試執行後使用@after註解並清理? – Mikhail

回答

0
Scenario: Bulk import of portfolios and treaties 
    Given the user logs into 「dev」 environment as 「User 」 with password "Password1" 
    And the user Chooses to import a portfolio providing SQLServer as "10.10.10.10」 
    And the user chooses uploaded Anytime 
    And the user enters the filter criteria for 「Client_EDM」 
    And the user expands the Edm 
    And the user expands the portfolios dropdown 
    And the user chooses the Name as "UK COM for v0.7" 
    And the user chooses the contract as "" 

    Scenario Outline: Import of portfolio 
    Given the user clicks on Import button 
    And the user specifies the ImportJobName as "<ImportName>" 
    And the user specifies the project "<EDM>" 
    And the user specifies the structure "<StructureName>" 
    And the user submits a portfolio for Import 
    Examples: 
     | EDM    | ImportName   | StructureName| 
     |Client1_EDM|EUFL_UK_Com_Import100|EUFLCom_Import101| 
     |Client2_EDM|EUFL_UK_Com_Import101|EUFLCom_Import101| 
+0

其實並非如此,但有趣的解決方案! – Marit