Skip to main content

aiogram_bot_tester

aiogram telegram status python PyPI Downloads

[!WARNING] This library is under active development. Its API is unstable and may contain frequent breaking changes between releases.

Installation

Stable version:

pip install aiogram_bot_tester

Latest development version:

pip install git+https://github.com/samedit66/aiogram-bot-tester.git

What's that?

aiogram_bot_tester is a lightweight way to test aiogram bots offline, without real Telegram API calls. It helps you simulate updates, check bot responses, and keep tests deterministic, so bot logic can be covered with confidence even when the conversation flow is complex.

Quick example

import pytest
import aiogram
from aiogram import F
from aiogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, Message

from aiogram_bot_tester import BotTester

router = aiogram.Router()


@router.message(aiogram.filters.CommandStart())
async def cmd_start(message: Message) -> None:
    await message.answer(
        "Hello! Press Continue or send me your name.",
        reply_markup=InlineKeyboardMarkup(
            inline_keyboard=[
                [InlineKeyboardButton(text="Continue", callback_data="continue")]
            ]
        ),
    )


@router.message(F.text)
async def echo_name(message: Message) -> None:
    await message.answer(f"Nice to meet you, {message.text}!")


@router.callback_query(F.data == "continue")
async def on_continue(callback: CallbackQuery) -> None:
    await callback.message.answer("Please send your name.")


@pytest.mark.asyncio
async def test_flow() -> None:
    tester = BotTester.from_routers(router)

    response = await tester.start()
    response.assert_contains("Hello")
    response.assert_button("Continue")

    response = await tester.tap_button("Continue")
    response.assert_contains("Please send your name.")

    response = await tester.send_message("Bob")
    response.assert_contains("Nice to meet you, Bob!")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiogram_bot_tester-2.0.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiogram_bot_tester-2.0.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file aiogram_bot_tester-2.0.0.tar.gz.

File metadata

  • Download URL: aiogram_bot_tester-2.0.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiogram_bot_tester-2.0.0.tar.gz
Algorithm Hash digest
SHA256 01fc3332c6aa9306503ff074f2bc2b5b4bcecb1e98892d9cda8604b7874f9cc1
MD5 754954940b5a397b4985a1d8f7525f9b
BLAKE2b-256 757baa498aeead7e57fea2432f2b568f003ac8fd56fdcb432fb598966d82f949

See more details on using hashes here.

File details

Details for the file aiogram_bot_tester-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiogram_bot_tester-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiogram_bot_tester-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a844594d198cb68e3b7fb60eea35867b16f4a65b8a76d9e875d6cd688d2ab3c6
MD5 0548f3b33850cb4c30319bd5a8fd902a
BLAKE2b-256 21c18e859e88dbeff582609c0f44a6fdb2f09ee89bb13081edcf1f94706c41bc

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.0

2 files

2.1.0

2 files

This release

2.0.0 This release

2 files

1.0.1

2 files

1.0.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page