2016-04-28 7 views
0

Ich habe 1 Feature-Datei wie dieseGurke - Wie man eine Feature-Datei mit mehreren Scenario in der gleichen Vorlage ausführen?

Feature: Swissdec von Lohnzetteln

Scenario Outline: 
Given Payslips based on the swissdec example salary item types (and formulas). 

Scenario: SwissdecPaySlips01: the employee is in working age and get correct payslip with AHV_DEDUCTION 
Given we use employee with name "Peter Bosshard" 
    And Company with name "Muster AG" 
    And Monthly salary of CHF 100000.00 
    And Salary Item Type is attached: 1000, 5000, 9010, 5010 
When the payslip for 04.2016 is requested 
Then we get a payslip with the following items 
    | 1000 | MONTHLY_SALARY     | 100000.00 | 
    | 5000 | GROSS_SALARY     | 100000.00 | 
    | 9010 | AHV_BASIS      | 100000.00 | 
    | 5010 | AHV_DEDDUCTION     | -5125.00 | 
    And a period from 2016.04.01 to 2016.04.30 

Scenario: SwissdecPaySlips02: the employee is in working age and get correct payslip with AHV_DEDUCTION 
Given we use employee with name "Hoang Nguyen" 
    And Company with name "Axon Active" 
    And Monthly salary of CHF 100000.00 
    And Salary Item Type is attached: 1000, 5000, 9010, 5010 
When the payslip for 04.2016 is requested 
Then we get a payslip with the following items 
    | 1000 | MONTHLY_SALARY     | 100000.00 | 
    | 5000 | GROSS_SALARY     | 100000.00 | 
    | 9010 | AHV_BASIS      | 100000.00 | 
    | 5010 | AHV_DEDDUCTION     | -5125.00 | 
    And a period from 2016.04.01 to 2016.04.30 

Die propblem, die ich foreach Zeit, diese Gurke Testfall ausgeführt werden. Jeder Schritt:

@Given("^we use employee with name \"([^\"]*)\"$") 
public void we_use_employee_with_name(String employeeName) { 
} 

wird 2 Mal ausgeführt. Weil es mit 2 Schritten in 2 Szenarien übereinstimmt

Wie kann ich Testszenario nach Szenario und Schritt für Schritt nach oben ausführen?

Dank

Antwort

1

best practice in Funktion für Szenarien Tags zu verwenden ist, und führen Sie sie zB mit runner Klassen für:

@ tag1 Szenario: Schritte

@ tag2 Szenario: Schritte

und auch wenn Sie etwas mehr über die issure erklären können, wird groß sein

+0

Vielen Dank für Ihr Feedback, ich habe mein Problem bereits gelöst. @ Ranjiths –

+0

@Duc wenn Sie es dann gelöst haben, dann bitte hier angeben .. – csf