http://www.technicalpage.net/search/label/SQL

Tags in feature file BDD Cucumber



feature file:

@sprint7
Feature: Sprint7

      @smoke
  Scenario Outline: TestLogin     #Outline should be added here to use example
    Given Open chrome browser and maximize
    And Open www.facebook.com
    And Enter "<uid_ColumnName>" and "<pwd_ColumnName>" and click login
    Then Validate screen
    And Close the session
    Examples:
      | uid_ColumnName | pwd_ColumnName |
      | realuid1       | realpwd1       |

      @functional @unit
  Scenario Outline: TestLogin     #Outline should be added here to use example
    Given Open chrome browser and maximize
    And Open www.facebook.com
    And Enter "<uid_ColumnName>" and "<pwd_ColumnName>" and click login
    Then Validate screen
    And Close the session

    Examples:
      | uid_ColumnName | pwd_ColumnName |
      | realuid2       | realpwd2       |
     
            @unit
  Scenario Outline: TestLogin     #Outline should be added here to use example
    Given Open chrome browser and maximize
    And Open www.facebook.com
    And Enter "<uid_ColumnName>" and "<pwd_ColumnName>" and click login
    Then Validate screen
    And Close the session

    Examples:
      | uid_ColumnName | pwd_ColumnName |
      | realuid3       | realpwd3      |


Run only functional and unit tests:
package testrunner;

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(
features="\\Users\\path\\featureFile.feature",
glue={"stepDefinition"},
//format={"html:output/report_html"},
//format={"html:output/report_html"},
//format={"pretty"},
//format={"json:json_output1/report.json","usage:targetFolder/report.json"},
format={"pretty"},
tags={"@functional,@unit"} //”,” means OR
)
public class TestRunner {

}

OR AND and Ignore in feature file:
OR operator in feature file: {"@functional,@unit"}
AND operator in feature file: {"@functional”,”@unit"}
Ignore test cases:
{"~@functional”,”@unit"} //only @unit will run
{"~@functional”,”~@unit"} //test cases other than @regression and @unit will run , in our case only @smoke will run
{"~@functional”,”~@unit", “~@smoke”} //Test cases other than having these tags will run but in our case there is no other test cases.

No comments:

Post a Comment