Feature1.feature
@Feature 1
Feature: Data validation
Background:
Given Make a connection to DB
Scenario Outline: Prepare the SF data quality check query and extract the data
When Prepare the SF query with date range "<startdate>","<enddate>"
Then Extract the SF data in an excel document "<startdate>","<enddate>"
Feature2.feature
@Feature 2
Feature: Data validation
Background:
Given Make a connection to DB
Scenario Outline: Prepare the DF data quality check query and extract the data
When Prepare the DF query with date range "<startdate>","<enddate>"
Then Extract the DF data in an excel document "<startdate>","<enddate>"
Both Feature 1 and Feature 2 uses the same background. The test runner gives me an initialization error since both the feature files have the same name, "Given." How can I reuse here by keeping the Given step in one place instead of giving different names in each Feature file? Please advise.
Instructor
Ashish Thakur Replied on 07/10/2021
if both the feature files are linked to the same glue code then you can try giving background in 1 of them