
- 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 - Multiline Text
A block of text after a step enclosed in """ will be linked with that step. Here, the indentation is parsed. All the whitespaces at the beginning are removed from the text and all the succeeding lines must have at least a minimum whitespace as the starting line.
A text is accessible to the implementation Python code with the .text attribute within the context variable (passed in the step function).
Feature File
The feature file for feature titled User information is as follows −
Feature − User information Scenario − Check login functionality Given user enters name and password """ Tutorialspoint Behave Topic – Multiline Text """ Then user should be logged in
Corresponding Step Implementation File
The corresponding step implementation file for the feature is as follows −
from behave import * @given('user enters name and password') def step_impl(context): #access multiline text with .text attribute print("Multiline Text: " + context.text) @then('user should be logged in') def step_impl(context): pass
Output
The output obtained after running the feature file is mentioned below and the command used is behave --no-capture -f plain.

The output shows the multiline text printed.