- Behave - Discussion
- Behave - Useful Resources
- Behave - Quick Guide
- Behave - Debugging
- Behave - Hooks
- Behave - Reports
- Behave - Retry Mechanism
- Behave - Exclude Tests
- Behave - Runner Script
- Behave - Step Parameters
- Behave - Step Functions
- Behave - Multi-Methods
- Behave - Optional Part
- Behave - Regular Expressions
- Behave - Step Matchers
- Behave - Enumeration
- Behave - Tags
- Behave - Data Types
- Behave - Background
- Behave - Steps in a Step
- Behave - Setup Table
- Behave - Multiline Text
- Behave - Scenario Outlines
- Behave - Step Parameters
- Behave - Supported Languages
- Behave - First Steps
- Behave - Step Implementations
- Behave - Feature Files
- Behave - Gherkin Keywords
- Behave - Feature Testing Setup
- Behave - Configuration Files
- Behave - Command Line
- Behave - Installation
- Behave - Introduction
- Behave - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Behave - Multipne Text
A block of text after a step enclosed in """ will be pnked with that step. Here, the indentation is parsed. All the whitespaces at the beginning are removed from the text and all the succeeding pnes must have at least a minimum whitespace as the starting pne.
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 functionapty Given user enters name and password """ Tutorialspoint Behave Topic – Multipne 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 multipne text with .text attribute print("Multipne 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 multipne text printed.
Advertisements