A flexible framework for evaluating reinforcement learning agents in Farama Gymnasium and PettingZoo environments.
Project description
Gimitest
The Gimitest software enhances the Farama Gymnasium, PettingZoo, and similar frameworks by modifying its reset(...) and step(...) methods, thereby simplifying the testing process of Reinforcement Learning (RL) agents at specific time steps and episode terminations, whether in training or testing phases.
A decorator design pattern is used to modify the functionality of an object at runtime.
We use the decorator design pattern to extend the reset(...) and step(...) methods of the single-agent and multi-agent RL environments, allowing for testing at specific time intervals and episode terminations.
Customizable Gimitest capabilities for single-agent and multi-agent systems include:
- Search-based testing
- Adversarial testing
- Metamorphic testing
- Logging capabilities
- Automated testing
See examples in the examples folder.
Watch the video for a quick demonstration.
🚀 Getting Started
Install package via:
pip install git+https://github.com/DennisGross/gimitest.git
Gimitest allows us to decorate our first environment with only a few extra lines:
import gymnasium as gym
from gimitest.env_decorator import EnvDecorator
from gimitest.gtest import GTest
# Create environment
env = gym.make('CartPole-v1')
# Create Gimitest object
m_gtest = GTest(env)
# Decorate the environment with it
EnvDecorator.decorate(env, m_gtest)
# THE REST IS THE SAME...
👮🏼♂️ GTest
While GTest serves as a base class, it's designed to be flexible and extendable. Users can create custom GTest subclasses and override specific methods to suit their testing needs.
The step(...)-wrapping first executes the pre_step_configuration(...) method, then the pre_step_test(...) method, then the original step(...) method, then the post_step_test(...) method, and finally the post_step_configuration(...) method.
The reset(...)-wrapping first executes the pre_reset_test(...) method, then the pre_reset_configuration(...) method, then the original reset(...) method, then the post_reset_test(...) method, and finally the post_reset_configuration(...) method.
Configuration Methods
The configuration methods allow us to override the way how your GTest can modify the environment. For instance, changing the gravity or cart mass in the ccartpole environment at different times (pre/post/reset/step):
pre_step_configuration(...)post_step_configuration(...)pre_reset_configuration(...)post_reset_configuration(...)
To access internal environment parameters, we can use the original_env = env.unwrapped to unwrap the environments and access the attributes as usually (original_env.ATTRIBUTE_NAME).
However, sometims this does not work and Gimitest allows via get_attribute(...) and set_attribute(...) to modify internal environment parameters, too.
Testing Methods
The testing methods allow us to create specific tests at different times (pre/post/reset/step):
pre_step_test(...)post_step_test(...)pre_reset_test(...)post_reset_test(...)
📊 GLogger
GLogger allows us to log the whole testing process at every point in time.
Just decorate GTest with a GLogger:
from gimitest.glogger import GLogger
m_logger = GLogger("m_log")
GTestDecorator.decorate_with_logger(m_gtest, m_logger)
🛠️ Modifications
If you want to modify Gimitest, please follow the steps below:
- Clone the repository:
git clone https://github.com/DennisGross/gimitest.git
- Install the requirements:
pip install -r requirements.txt
- Modify the code as you wish.
📜 Citation
If you use Gimitest in your research, please cite the following:
@software{Gross_gimitest_2025,
author = {Gross, Dennis and Mazouni, Quentin and Spieker, Helge},
license = {MIT},
month = may,
title = {{Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policies}},
url = {https://github.com/DennisGross/gimitest},
version = {1.0},
year = {2025}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gimitest-1.0.tar.gz.
File metadata
- Download URL: gimitest-1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
360f2d35fa7d7dd93aa033090f7ae4528fa6375900d5356ff370e8f8e9245e70
|
|
| MD5 |
654da073083894243b18243c4f45abc0
|
|
| BLAKE2b-256 |
6c3aaa48f468fdd304c8ed9b85bbabd2d1d2695a7d33556dc5b5cff8faacb2bf
|
Provenance
The following attestation bundles were made for gimitest-1.0.tar.gz:
Publisher:
release.yml on DennisGross/gimitest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gimitest-1.0.tar.gz -
Subject digest:
360f2d35fa7d7dd93aa033090f7ae4528fa6375900d5356ff370e8f8e9245e70 - Sigstore transparency entry: 208511319
- Sigstore integration time:
-
Permalink:
DennisGross/gimitest@b5594251e32c4b21ee62bb1bef679756f1075122 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DennisGross
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5594251e32c4b21ee62bb1bef679756f1075122 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gimitest-1.0-py3-none-any.whl.
File metadata
- Download URL: gimitest-1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11971275aa2e65bb432e4111072b0672e1832e41cbd5db4544eb66b6451207e0
|
|
| MD5 |
a5e58b1cdf00e6181db3488191ef857d
|
|
| BLAKE2b-256 |
c7fc43328c99d22f8bf0248b59b44908851fdb30111c66daf015345b770898aa
|
Provenance
The following attestation bundles were made for gimitest-1.0-py3-none-any.whl:
Publisher:
release.yml on DennisGross/gimitest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gimitest-1.0-py3-none-any.whl -
Subject digest:
11971275aa2e65bb432e4111072b0672e1832e41cbd5db4544eb66b6451207e0 - Sigstore transparency entry: 208511321
- Sigstore integration time:
-
Permalink:
DennisGross/gimitest@b5594251e32c4b21ee62bb1bef679756f1075122 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DennisGross
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5594251e32c4b21ee62bb1bef679756f1075122 -
Trigger Event:
workflow_dispatch
-
Statement type: