lemoncheesecake: a functional test framework for Python

lemoncheesecake makes reporting the first class citizen while providing modern test features such as fixtures and matchers.

Here is a test example:

import json
import requests

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

SUITE = {
    "description": "Github tests"
}

URL = "https://api.github.com/orgs/lemoncheesecake"


@lcc.test("Test Organization end-point")
def organization():
    lcc.set_step("Get lemoncheesecake organization information")
    lcc.log_info("GET %s" % URL)
    resp = requests.get(URL)
    require_that("HTTP code", resp.status_code, is_(200))
    data = resp.json()
    lcc.log_info("Response\n%s" % json.dumps(data, indent=4))

    lcc.set_step("Check API response")
    check_that_in(
        data,
        "type", is_("Organization"),
        "id", is_integer(),
        "description", is_not_none(),
        "login", is_(present()),
        "created_at", match_pattern("^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$"),
        "has_organization_projects", is_true(),
        "followers", is_(greater_than_or_equal_to(0)),
        "following", is_(greater_than_or_equal_to(0)),
        "repos_url", ends_with("/repos"),
        "issues_url", ends_with("/issues"),
        "events_url", ends_with("/events"),
        "hooks_url", ends_with("/hooks"),
        "members_url", ends_with("/members{/member}"),
        "public_members_url", ends_with("/public_members{/member}")
    )

And here are the corresponding test results:

_images/report-sample.png

See Getting Started to create your first test project.

News

On August 11th, 2019, lemoncheesecake 1.0.0 has been released. This major release brings (among other things):

  • various API improvements
  • type annotations for most of the API
  • improved documentation
  • a new API reference documentation

The full changelog is available here.

This version is not compatible with prior 0.22.x releases. The migration process is documented in Migrating from to 0.22.x to 1.x.

Features

  • Advanced test hierarchies using suites, tests and nested suites
  • Test description and metadata: tags, properties (key=value associations) and links
  • Support for test filtering
  • Multiple reporting flavors built-in: HTML, JSON, XML, JUnit, ReportPortal, Slack notifications
  • BDD support using behave
  • Test parallelization
  • Rich CLI toolbox

lemoncheesecake is compatible with Python 2.7, 3.5-3.8.

Changelog

The Changelog will tell you about features, improvements, fixes and possible backward-incompatibilities of each version.

Installation and configuration

Contact

Bugs and improvement ideas are welcomed in tickets. A Google Groups forum is also available for discussions about lemoncheesecake: https://groups.google.com/forum/#!forum/lemoncheesecake .

License

lemoncheeseake is licensed under the Apache License