
- Behave Tutorial
- 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 - Quick Guide
- Behave - Useful Resources
- Behave - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Behave - Retry Mechanism
We can rerun failed Scenarios in the feature file in Behave. This is taken care with the help of the formatters.
All the available formatters in Behave can be seen with the command given below −
behave –f help
You can see the following screen after using the command −

The rerun formatter is used to capture the failing scenario and output it in a separate file. Let us take an example, where we have 1 failed feature.

Then capture the failed feature in another feature file with the command −
behave –f rerun –o failed_features.feature
You can see the following −

The failed_features.feature file gets generated within the project. It contains the feature file name Payment1.feature where we have a failure.

To re-trigger only failed Scenario, we have to run the command stated below −
behave @failed_features.feature
You will see the following screen −
