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}
}
Metadata
Release files for gimitest 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gimitest-1.0.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gimitest-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.6 kB
Release files / gimitest-1.0.tar.gz
| Download URL | gimitest-1.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
360f2d35fa7d7dd93aa033090f7ae4528fa6375900d5356ff370e8f8e9245e70
|
|
BLAKE2b-256 checksum How to use checksums |
6c3aaa48f468fdd304c8ed9b85bbabd2d1d2695a7d33556dc5b5cff8faacb2bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2025.
Transparency logRelease files / gimitest-1.0-py3-none-any.whl
| Download URL | gimitest-1.0-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11971275aa2e65bb432e4111072b0672e1832e41cbd5db4544eb66b6451207e0
|
|
BLAKE2b-256 checksum How to use checksums |
c7fc43328c99d22f8bf0248b59b44908851fdb30111c66daf015345b770898aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2025.
Transparency log