Thick Brush Stroke

Using Visual Studio Code for Behave BDD tests in Python

Thick Brush Stroke

Introduction

Python is supported by Visual Studio Code. Both PyCharm and Visual Studio Code are top IDEs for automating Python-behave code.

Thick Brush Stroke

Python-Behave

To use Behave with Python, we must use pycharm professional edition, which is not free. we can use vscode instead, as we discussed in detail in our blog.

Thick Brush Stroke

Extensions needed for Python-Behave

1. Gherkin: For creating feature files 2. Pylance: For installing all libraries which are required to run Python 3. Python: For Python coding

Thick Brush Stroke

Create launch.json  file

This file will help you run feature files through VsCode. You can create this file after going to the Run & Debug option.

Thick Brush Stroke

Navigate to a specific feature

Although this functionality is already present in PyCharm, we were able to successfully implement it in VSCode by applying some coding logic. For future information visit our blog mentioned in the below link

Thick Brush Stroke

Cloud Environment

Python automation scripts can be successfully run in cloud environments like SauceLabs and BrowserStack through VSCode.

Thick Brush Stroke

Debug Mode

You can run your code in debug mode and step through it using VSCode.

Thick Brush Stroke

IntelliSense code

VS Code employs IntelliSense code intelligence and error-checking as you type.

Thick Brush Stroke

Conclusion

Visual Studio Code will help Testers save money and run Python behave freely on the VSCode IDE rather than using Pycharm which is not free.