- Behave - Home
- Behave - Introduction
- Behave - Installation
- Behave - Command Line
- Behave - Configuration Files
- Behave - Feature Testing Setup
- Behave - Gherkin Keywords
- Behave - Feature Files
- Behave - Step Implementations
- Behave - First Steps
- Behave - Supported Languages
- Behave - Step Parameters
- Behave - Scenario Outlines
- Behave - Multiline Text
- Behave - Setup Table
- Behave - Steps in a Step
- Behave - Background
- Behave - Data Types
- Behave - Tags
- Behave - Enumeration
- Behave - Step Matchers
- Behave - Regular Expressions
- Behave - Optional Part
- Behave - Multi-Methods
- Behave - Step Functions
- Behave - Step Parameters
- Behave - Runner Script
- Behave - Exclude Tests
- Behave - Retry Mechanism
- Behave - Reports
- Behave - Hooks
- Behave - Debugging
Behave Useful Resources
Behave - Exclude Tests
We can exclude the executing files by its filename from execution.
Suppose, we have more than one feature file within the features folder. The following screen can be seen on the computer −
On executing the command behave, the output will be as follows −
(myenv) D:\behave\myenv\pythonProject>behave
USING RUNNER: behave.runner:Runner
Feature: Multi-Methods # features/payment.feature:1
Scenario: Purchase # features/payment.feature:2
Given User is on shop # features/steps/stepImpPayment.py:11 0.000s
When user purchases 3 shirts # features/steps/stepImpPayment.py:15 0.000s
And user purchases 4 pants # features/steps/stepImpPayment.py:21 0.000s
Feature: Multi-Methods # features/payment1.feature:1
Scenario: Purchase # features/payment1.feature:2
Given User is on shop # features/steps/stepImpPayment.py:11 0.000s
When user purchases 3 shirts # features/steps/stepImpPayment.py:15 0.000s
And user purchases 4 pants # features/steps/stepImpPayment.py:21 0.000s
2 features passed, 0 failed, 0 skipped
2 scenarios passed, 0 failed, 0 skipped
6 steps passed, 0 failed, 0 skipped
Took 0min 0.000s
If we have to only run the feature file Payment.feature and exclude Payment1.feature, we have to pass the command line argument --e or --exclude followed by pattern of the regular expression.
On executing the command behave --exclude payment1.feature, the output is as follows −
(myenv) D:\beautiful_soup\myenv\pythonProject>behave --exclude payment1.feature
USING RUNNER: behave.runner:Runner
Feature: Multi-Methods # features/payment.feature:1
Scenario: Purchase # features/payment.feature:2
Given User is on shop # features/steps/stepImpPayment.py:11 0.000s
When user purchases 3 shirts # features/steps/stepImpPayment.py:15 0.000s
And user purchases 4 pants # features/steps/stepImpPayment.py:21 0.000s
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
3 steps passed, 0 failed, 0 skipped
Took 0min 0.000s
The output shows one feature passed along with the Payment.feature file name. Also, Payment1.feature is not included in the run.
Advertisements