{"id":36625416,"url":"https://github.com/balder-dev/balder","last_synced_at":"2026-01-12T09:31:25.451Z","repository":{"id":48971204,"uuid":"517012520","full_name":"balder-dev/balder","owner":"balder-dev","description":"Balder is a python test system that allows you to reuse a once written testcode for different but similar platforms/devices/applications.","archived":false,"fork":false,"pushed_at":"2025-10-21T17:12:09.000Z","size":1945,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T19:14:48.203Z","etag":null,"topics":["balder","framework","python","reusable-tests","scenario-test","test","testframework","testing"],"latest_commit_sha":null,"homepage":"https://balder.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balder-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-23T09:21:49.000Z","updated_at":"2025-10-21T17:12:16.000Z","dependencies_parsed_at":"2024-03-14T17:59:01.283Z","dependency_job_id":"42405e98-1867-4dce-b207-b11230212f7b","html_url":"https://github.com/balder-dev/balder","commit_stats":{"total_commits":118,"total_committers":3,"mean_commits":"39.333333333333336","dds":0.5508474576271186,"last_synced_commit":"e11ef1f17dcc99449a4f982c63060c9092372886"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/balder-dev/balder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balder-dev%2Fbalder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balder-dev%2Fbalder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balder-dev%2Fbalder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balder-dev%2Fbalder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balder-dev","download_url":"https://codeload.github.com/balder-dev/balder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balder-dev%2Fbalder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["balder","framework","python","reusable-tests","scenario-test","test","testframework","testing"],"created_at":"2026-01-12T09:31:25.371Z","updated_at":"2026-01-12T09:31:25.436Z","avatar_url":"https://github.com/balder-dev.png","language":"Python","readme":"\n\u003cdiv align=\"center\"\u003e\n  \u003cimg style=\"margin: 20px;max-width: 68%\" src=\"https://docs.balder.dev/en/latest/_static/balder_w_boarder.png\" alt=\"Balder logo\"\u003e\n\u003c/div\u003e\n\nBalder is a flexible Python test system that allows you to reuse test code written once for different but similar \nplatforms, devices, or applications. It enables you to install ready-to-use test cases and provides various test \ndevelopment features that help you test your software or devices much faster.\n\nYou can use shared test code by installing an [existing BalderHub project](https://hub.balder.dev), or you can create \nyour own. This makes test development for your project much faster, since it is oftentimes enough to install a BalderHub\nproject and only provide the user-specific code.\n\nBe part of the progress and share your tests with others, your company, or the whole world.\n\n# Installation\n\nYou can install the latest release with pip:\n\n```\npython -m pip install baldertest\n```\n\n# Run Balder\n\nAfter you've installed it, you can run Balder inside a Balder environment with the following command:\n\n```\nbalder\n```\n\nYou can also provide a specific path to the balder environment directory by using this console argument:\n\n```\nbalder --working-dir /path/to/working/dir\n```\n\n# How does it work?\n\nBalder allows you to reuse previously written test code by dividing it into the components that **are needed** for a \ntest (`Scenario`) and the components that **you have** (`Setup`).\n\nYou can define a test within a method of a `Scenario` class. This is often an abstract layer, where you only describe \nthe general business logic without providing any specific implementation details.\n\nThese specific implementation details are provided in the `Setup` classes. They describe exactly **what you have**. In \nthese classes, you provide an implementation for the abstract elements that were defined earlier in the `Scenario`. \n\nBalder then automatically searches for matching mappings and runs your tests using them.\n\n## Define the `Scenario` class\n\nInside `Scenario` or `Setup` classes, you can describe the environment using inner `Device` classes. For example, let's \nwrite a test that validates the functionality of a lamp. For that, keep in mind that we want to make this test as \nflexible as possible. It should be able to run with all kind of things that have a lamp:\n\n```python\nimport balder\nfrom lib.scenario_features import BaseLightFeature\n\n\nclass ScenarioLight(balder.Scenario):\n    \n    # The device with its features that are required for this test\n    class LightSpendingDevice(balder.Device):\n        light = BaseLightFeature()\n    \n    def test_check_light(self):\n        self.LightSpendingDevice.light.switch_on()\n        assert self.LightSpendingDevice.light.light_is_on()\n        self.LightSpendingDevice.light.switch_off()\n        assert not self.LightSpendingDevice.light.light_is_on()\n        \n    \n\n```\n\nHere, we have defined that a `LightSpendingDevice` **needs to have** a feature called `BaseLightFeature` so that this \nscenario can be executed.\n\nWe have also added a test case (named with a `test_*()` prefix) called `test_check_light`, which executes the validation\nof a lamp, by switching it on and off and checking its state.\n\n**Note:** The `BaseLightFeature` is an abstract Feature class that defines the abstract methods `switch_on()`, \n`switch_off()`, and `light_is_on()`.\n\n\n## Define the `Setup` class\n\nThe next step is defining a `Setup` class, which describes what we have. For a `Scenario` to match a `Setup`, the \nfeatures of all scenario devices must be implemented by the mapped setup devices.\n\nFor example, if we want to test a car that includes a lamp, we could have a setup like the one shown below:\n\n```python\nimport balder\nfrom lib.setup_features import CarEngineFeature, CarLightFeature\n\n\nclass SetupGarage(balder.Setup):\n    \n    class Car(balder.Device):\n        car_engine = CarEngineFeature()\n        car_light = CarLightFeature() # subclass of `lib.scenario_feature.BaseLightFeature`\n        ...\n    \n\n```\n\nWhen you run Balder in this environment, it will collect the `ScenarioLight` and the `SetupMyCar` classes and try to \nfind mappings between them. Based on the `ScenarioLight`, Balder looks for a device that provides an implementation of \nthe single `BaseLightFeature`. To do this, it scans all available setups. Since the `SetupMyCar.Car` device provides an \nimplementation through the `CarLightFeature`, this device will match.\n\n```shell\n+----------------------------------------------------------------------------------------------------------------------+\n| BALDER Testsystem                                                                                                    |\n|  python version 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] | balder version 0.1.0b14                         |\n+----------------------------------------------------------------------------------------------------------------------+\nCollect 1 Setups and 1 Scenarios\n  resolve them to 1 valid variations\n\n================================================== START TESTSESSION ===================================================\nSETUP SetupGarage\n  SCENARIO ScenarioLight\n    VARIATION ScenarioLight.LightSpendingDevice:SetupGarage.Car\n      TEST ScenarioLight.test_check_light [.]\n================================================== FINISH TESTSESSION ==================================================\nTOTAL NOT_RUN: 0 | TOTAL FAILURE: 0 | TOTAL ERROR: 0 | TOTAL SUCCESS: 1 | TOTAL SKIP: 0 | TOTAL COVERED_BY: 0\n```\n\n## Add another Device to the `Setup` class\n\nNow the big advantage of Balder comes into play. We can run our test with all devices that can implement the \n`BaseLightFeature`, independent of how this will be implemented in detail. **You do not need to rewrite the test**.\n\nSo, We have more devices in our garage. So let's add them:\n\n```python\nimport balder\nfrom lib.setup_features import CarEngineFeature, CarLightFeature, PedalFeature, BicycleLightFeature, GateOpenerFeature\n\n\nclass SetupGarage(balder.Setup):\n    \n    class Car(balder.Device):\n        car_engine = CarEngineFeature()\n        car_light = CarLightFeature() # subclass of `lib.scenario_feature.BaseLightFeature`\n        ...\n    \n    class Bicycle(balder.Device):\n        pedals = PedalFeature()\n        light = BicycleLightFeature() # another subclass of `lib.scenario_feature.BaseLightFeature`\n        \n    class GarageGate(balder.Device):\n        opener = GateOpenerFeature()\n\n```\n\nIf we run Balder now, it will find more mappings because the `Bicycle` device also provides an implementation for the \n`BaseLightFeature` we are looking for.\n\n```shell\n+----------------------------------------------------------------------------------------------------------------------+\n| BALDER Testsystem                                                                                                    |\n|  python version 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] | balder version 0.1.0b14                         |\n+----------------------------------------------------------------------------------------------------------------------+\nCollect 1 Setups and 1 Scenarios\n  resolve them to 2 valid variations\n\n================================================== START TESTSESSION ===================================================\nSETUP SetupGarage\n  SCENARIO ScenarioLight\n    VARIATION ScenarioLight.LightSpendingDevice:SetupGarage.Bicycle\n      TEST ScenarioLight.test_check_light [.]\n    VARIATION ScenarioLight.LightSpendingDevice:SetupGarage.Car\n      TEST ScenarioLight.test_check_light [.]\n================================================== FINISH TESTSESSION ==================================================\nTOTAL NOT_RUN: 0 | TOTAL FAILURE: 0 | TOTAL ERROR: 0 | TOTAL SUCCESS: 2 | TOTAL SKIP: 0 | TOTAL COVERED_BY: 0\n```\n\nBalder handles all of this for you. You only need to describe your environment by defining `Scenario` and `Setup` \nclasses, then provide the specific implementations by creating the features. Balder will automatically search for and \napply the mappings between them.\n\n**NOTE:** Balder offers many more elements to design complete device structures, including connections between multiple \ndevices.\n\nYou can learn more about that in the \n[Tutorial Section of the Documentation](https://docs.balder.dev/en/latest/tutorial_guide/index.html).\n\n\n# Example: Use an installable BalderHub package\n\nWith Balder, you can create custom test environments or install open-source-available test packages, known as \n[BalderHub packages](https://hub.balder.dev). For example, if you want to test the login functionality of a website, simply use the \nready-to-use scenario `ScenarioSimpleLogin` from the [`balderhub-auth` package](https://hub.balder.dev/projects/auth/en/latest/examples.html), \n\n\nWe want to use [Selenium](https://www.selenium.dev/) to control the browser and of course use html elements, so let's install \n`balderhub-selenium` and `balderhub-html` right away.\n\n```\n$ pip install balderhub-auth balderhub-selenium balderhub-html\n```\n\nSo as mentioned, you don't need to define a scenario and a test yourself; you can simply import it:\n\n```python\n# file `scenario_balderhub.py`\n\nfrom balderhub.auth.scenarios import ScenarioSimpleLogin\n\n```\n\nAccording to the [documentation of this BalderHub project](https://hub.balder.dev/projects/auth/en/latest/examples.html), \nwe only need to define the login page by overwriting the ``LoginPage`` feature:\n\n```python\n\n# file `lib/pages.py`\n\nimport balderhub.auth.contrib.html.pages\nfrom balderhub.html.lib.utils import Selector\nfrom balderhub.url.lib.utils import Url\nimport balderhub.html.lib.utils.components as html\n\n\nclass LoginPage(balderhub.auth.contrib.html.pages.LoginPage):\n\n    url = Url('https://example.com')\n\n    # Overwrite abstract property\n    @property\n    def input_username(self):\n            return html.inputs.HtmlTextInput.by_selector(self.driver, Selector.by_name('user'))\n\n    # Overwrite abstract property\n    @property\n    def input_password(self):\n        return html.inputs.HtmlPasswordInput.by_selector(self.driver, Selector.by_name('user'))\n\n    # Overwrite abstract property\n    @property\n    def btn_login(self):\n        return html.HtmlButtonElement.by_selector(self.driver, Selector.by_id('submit-button'))\n\n```\n\nAnd use it in our setup:\n\n```python\n\n\n# file `setups/setup_office.py`\n\nimport balder\nimport balderhub.auth.lib.scenario_features.role\nfrom balderhub.selenium.lib.setup_features import SeleniumChromeWebdriverFeature\n\nfrom lib.pages import LoginPage\n\nclass UserConfig(balderhub.auth.lib.scenario_features.role.UserRoleFeature):\n    # provide the credentials for the log in\n        username = 'admin'\n        password = 'secret'\n\nclass SetupOffice(balder.Setup):\n\n    class Server(balder.Device):\n        user = UserConfig()\n\n    class Browser(balder.Device):\n        selenium = SeleniumChromeWebdriverFeature()\n        page_login = LoginPage()\n\n    # fixture to prepare selenium - will be executed before the test session runs\n    @balder.fixture('session')\n    def selenium(self):\n        self.Browser.selenium.create()\n        yield\n        self.Browser.selenium.quit()\n```\n\nWhen you run Balder now, it will execute a complete login test that you didn't write yourself - \n**it was created by the open-source community**.\n\n```shell\n+----------------------------------------------------------------------------------------------------------------------+\n| BALDER Testsystem                                                                                                    |\n|  python version 3.10.12 (main, Aug 15 2025, 14:32:43) [GCC 11.4.0] | balder version 0.1.0b14                         |\n+----------------------------------------------------------------------------------------------------------------------+\nCollect 1 Setups and 1 Scenarios\n  resolve them to 1 valid variations\n\n================================================== START TESTSESSION ===================================================\nSETUP SetupOffice\n  SCENARIO ScenarioSimpleLogin\n    VARIATION ScenarioSimpleLogin.Client:SetupOffice.Browser | ScenarioSimpleLogin.System:SetupOffice.Server\n      TEST ScenarioSimpleLogin.test_login [.]\n================================================== FINISH TESTSESSION ==================================================\nTOTAL NOT_RUN: 0 | TOTAL FAILURE: 0 | TOTAL ERROR: 0 | TOTAL SUCCESS: 1 | TOTAL SKIP: 0 | TOTAL COVERED_BY: 0\n```\n\nIf you'd like to learn more about it, feel free to dive [into the documentation](https://balder.dev).\n\n# Contribution guidelines\n\nAny help is appreciated. If you want to contribute to balder, take a look into the \n[contribution guidelines](https://github.com/balder-dev/balder/blob/main/CONTRIBUTING.md).\n\nAre you an expert in your field? Do you enjoy the concept of balder? How about creating your own\nBalderHub project? You can contribute to an existing project or create your own. If you are not sure, a project for \nyour idea already exists or if you want to discuss your ideas with others, feel free to\n[create an issue in the BalderHub main entry project](https://github.com/balder-dev/hub.balder.dev/issues) or\n[start a new discussion](https://github.com/balder-dev/hub.balder.dev/discussions).\n\n# License\n\nBalder is free and Open-Source\n\nCopyright (c) 2022-2025 Max Stahlschmidt and others\n\nDistributed under the terms of the MIT license\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalder-dev%2Fbalder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalder-dev%2Fbalder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalder-dev%2Fbalder/lists"}