Select Page
Automation Testing

Writing Automated Tests Using lemoncheesecake

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

In this blog article, you will get to know how to write automated tests using lemoncheesecake framework & Selenium WebDriver. lemoncheesecake is a python framework for functional testing. It has good reporting system, fixtures and matchers to create readable automated test scripts using Python. As a test automation company, we would like to show an example for lemoncheesecake framework using Selenium snippets.

Writing Automated Tests Using lemoncheesecake

How to install?

pip install lemoncheesecake

Create Default Project Once you execute the below, it will create a project (myproject) which contains fixtures folder, suites folder, & project.py file.

lcc bootstrap myproject

Create Test Suite Create a python file inside the suites folder with the below snippets. The code will launch Codoid website and verify the home page title using check_that method.

from selenium import webdriver
import time

import lemoncheesecake.api as lcc
from lemoncheesecake.matching import *

URL  = "https://codoid.com"

SUITE = {
"description": "My suite"
}

@lcc.test("Test 1")
def my_test():
    lcc.set_step("Launch URL")
    lcc.log_info("URL %s" % URL)

    driver = webdriver.Chrome(executable_path='driverschromedriver.exe')

    driver.get(URL)

    time.sleep(3)

    lcc.set_step("Verify page title")

    check_that("value",driver.title,starts_with("One of the best QA Companies"))

    lcc.log_info("Page Tile: %s" % driver.title)

    driver.quit()

Run The Test Suite Go to the suites folder and run the below command, it will run the test suite.

lcc run

View Test Result You can see the html test result under reports folder.

lemoncheesecake test report

In Conclusion:

In lemoncheesecake framework, you can send the automated reports to Slack & Report Portal as well. Executing scripts in parallel is also possible.

Comments(0)

Submit a Comment

Your email address will not be published. Required fields are marked *

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility