Listen to this blog |
Lemoncheesecake is a very well known Python testing framework. As a test automation services company, we have evaluated this framework for one of your automation testing projects. After the proof of concept stage, we decided to use lemoncheesecake framework to write automation test scripts. Initially, BDD support was not available. However, now you can use behave BDD framework in lemoncheesecake. In this blog article, you will learn how to write BDD tests using lemoncheesecake and behave frameworks.
Step #1: Installation
To setup BDD using behave and lemoncheesecake, you need only two dependencies (behave and lemoncheesecake packages). That’s it.
pip install lemoncheesecake pip install behave
Step #2: Setup LemonCheeseCake Project
Once the required dependencies are installed, you need to create LemonCheeseCake project. There is a command to do that. Run the below command. It will create LemonCheeseCake (LCC) project for you.
lcc bootstrap myproject
Step #3: Create a Feature
Create ‘features’ folder inside ‘myproject’ folder. Create a feature file inside the features folder.
Feature: LemonCheeseCake Demo Scenario: Demo Scenario Given I fill login details When I click login button Then I should see Home page
Step #4: Step Definition
from behave import * import lemoncheesecake.api as lcc from lemoncheesecake.matching import * @given("I fill login details") def step_impl(context): lcc.log_info("Pass") @when("I click login button") def step_impl(context): lcc.log_info("Pass") @then("I should see Home page") def step_impl(context): lcc.log_info("Pass")
Step #4: Create environment.py
Create environment.py inside myproject folder to install BDD hooks from behave.
from lemoncheesecake.bdd.behave import install_hooks install_hooks()
Step #5: Run
behave features/demofeature.feature
Once the execution is complete, you can find LCC HTML report in reports folder. The best thing about LCC is reporting. Your team will love it once they start getting reports from LemonCheeseCake framework.
In Conclusion
Why does one need to integrate behave with LCC? We as a software testing company, write BDD and non-BDD automated scripts using Java, Python, and JavaScript languages. Let’s say for instance if u wish to write automated test scripts for data quality checks and UI validations in a test automation framework. Then LemonCheeseCake and behave combination is the ideal choice. LCC framework is gaining popularity among automation testers. We hope that you have gained some useful insights from this article. Every other day, we publish a technical blog article. Subscribe to Codoid’s Blogs to get our updates on the recent technical developments, feel free to contact us for your automation testing needs.
Comments(0)