Registry / testing / robotframework-assertion-engine

robotframework-assertion-engine

JSON →
library5.0.1pypypi✓ verified 25d ago

Robot Framework Assertion Engine (version 4.0.0) provides a generic way to create meaningful and easy-to-use assertions for Robot Framework libraries. It is a spin-off from the Browser library project and offers a robust set of operators and formatters for in-keyword validation. The library is actively maintained with regular releases, including minor and major version updates to support new Robot Framework versions and introduce breaking changes.

pip install robotframework-assertion-engine
INSTALL
IMPORT
SIG · ROBOTFRAMEWORK-ASS
R
robotframework-assertion-engine
testingpythonv5.0.1
Install
2.0s avg
Import
685ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v5.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.702s · 24.1MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.0s · import 0.668s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AssertionOperator
✓ from assertionengine import AssertionOperator
✗ from AssertionEngine import AssertionEngine
verify_assertion
✓ from assertionengine import verify_assertion
✗ from AssertionEngine import AssertionEngine
assertion_engine
✓ from assertionengine import assertion_engine
✗ from AssertionEngine import AssertionEngine

This quickstart demonstrates how to integrate `robotframework-assertion-engine` into a custom Python library for Robot Framework. The `MyAssertions` class instantiates `AssertionEngine` and exposes keywords like `My Custom Assert Keyword` and `Verify Length` that utilize the engine's `verify_assertion` method. This allows library developers to easily add a wide range of assertions directly within their Python keywords, which can then be called from Robot Framework test cases.

import os from AssertionEngine import AssertionEngine class MyAssertions: def __init__(self): self._assertion_engine = AssertionEngine() def my_custom_assert_keyword(self, actual_value, operator, expected_value, message=""): """ Performs an assertion using the AssertionEngine. Example: | My Custom Assert Keyword | hello | == | hello | """ print(f"Performing assertion: '{actual_value}' {operator} '{expected_value}'") self._assertion_engine.verify_assertion( actual_value=actual_value, assertion_operator=operator, assertion_expected=expected_value, message=message ) def verify_length(self, value, operator, expected_length): """ Verifies the length of a string or list. Example: | Verify Length | ${MY_LIST} | > | 3 | """ actual_length = len(value) print(f"Verifying length of '{value}' (actual: {actual_length}) {operator} {expected_length}") self._assertion_engine.verify_assertion( actual_value=actual_length, assertion_operator=operator, assertion_expected=int(expected_length), message=f"Length of '{value}'" ) # To run with Robot Framework, save the above as 'MyAssertions.py' # and create a .robot file like this: # # *** Settings *** # Library MyAssertions.py # # *** Variables *** # ${MY_LIST} ${{ [1, 2, 3, 4, 5] }} # # *** Test Cases *** # Test String Equality # My Custom Assert Keyword hello == hello # # Test String Inequality # My Custom Assert Keyword world != robot # # Test Length Greater Than # Verify Length ${MY_LIST} > 3 # # Test Length Equal To # Verify Length Python == 6
Debug
Known issues
breakingVersion 3.0.0 introduced backwards incompatible changes to how scopes are defined. Scoping is now entirely managed by the library maintainer, and AssertionEngine no longer provides a keyword for scope definition.
fix
Review your custom library's scope management and adjust it to directly handle scope definitions without relying on AssertionEngine's previous keyword-based mechanism.
affects: >=3.0.0
breakingVersion 2.0.0 changed the logging of string error messages. Instead of plain text, strings are now converted using `repr()` to a printable representation, which includes Unicode values for whitespace characters. This can alter the appearance of error messages in logs.
fix
Adjust any automated parsing or expectations of error log formats, as string representations will now be more explicit (e.g., `\n` instead of a newline character).
affects: >=2.0.0
gotchaAssertionEngine v3.0.0 caused compatibility issues with `robotframework-browser` v16.0.0 (and Robot Framework 6.1.1) due to changes in the `Formatter()` constructor. This could lead to `TypeError: Formatter() takes no arguments` errors during library initialization.
fix
Ensure `robotframework-browser` is updated to a compatible version (e.g., v17.0.0 or newer), or pin `robotframework-assertion-engine` to version `2.0.0` if `robotframework-browser` cannot be updated.
affects: 3.0.0 - 3.x.x (when used with older `robotframework-browser` versions)
deprecatedPython 3.7 support was dropped in version 1.1.0. The library currently requires Python 3.10 or newer.
fix
Upgrade your Python environment to 3.10 or a newer supported version.
affects: >=1.1.0
Upgrade
Version history
5.0.1latest on PyPI · released Jun 4, 2026
Audit
Dependencies
robotframeworkrequiredCore dependency for creating and running Robot Framework tests and libraries.
Agent activity
7 hits · last 30 days
node
6
Resources
robotframework-assertion-engine — pip install robotframework-assertion-engine · libregistry