//SOLVEME_

Developer Tools / Testing · 2022

pycamel

A pytest-based framework for automated API testing

Published: · Updated:

PythonpytestAPI Testing
Role
Solo development of the test automation framework
Stack
Python, pytest, Pylint, Coverage, codecov
Year
2022

pycamel is an automation framework focused on covering API services with tests, integrating seamlessly with pytest. It gives teams a structured way to write API tests, especially useful for microservice architectures.

The challenge

When a team works with several services and API versions at once, scattered ad-hoc pytest scripts quickly turn into a mess with no shared structure or reusable building blocks.

The solution

  • ▸CamelConfig — configuration setup with a base service URL
  • ▸RouterMaker — route construction for different API endpoints
  • ▸Parametrized testing via pytest.mark.parametrize
  • ▸Response validation helpers, including assert_status_code
  • ▸Request filter support and easy extension for multi-service architectures

How it works

A project declares its base host once with CamelConfig in tests/conftest.py. Each service then gets its own RouterMaker with a path prefix such as /data-service/v1, and every endpoint becomes a reusable router exposed as a pytest fixture. Tests call router.get() or post() and assert on the response, so the test code mirrors the structure of the API itself.

  • ▸Default headers per router (Content-Type: application/json out of the box), plus set_headers and append_header that apply only to the next request
  • ▸Query parameters and filters via set_filters() for pagination and search
  • ▸Response validation against pydantic v2 schemas
  • ▸Separate router makers per API version (v1, v2) for services that evolve side by side

Maintenance

pycamel has been published on PyPI since 2022 and is still maintained: the current major version targets Python 3.10+ and pydantic v2, unit tests run on GitHub Actions and coverage is tracked on Codecov.

The result

The framework is set up for code quality: Pylint for static analysis, plus Coverage and codecov for tracking test coverage.

Mentions & sources