{"id":19901214,"url":"https://github.com/rbaltrusch/batest","last_synced_at":"2025-06-10T20:04:27.017Z","repository":{"id":134139620,"uuid":"337784718","full_name":"rbaltrusch/batest","owner":"rbaltrusch","description":"Lightweight batchfile unit testing framework","archived":false,"fork":false,"pushed_at":"2023-10-08T11:42:47.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T07:41:59.416Z","etag":null,"topics":["batch","batch-file","batchfile","framework","lightweight","test-automation","testing","tests","unit-testing","windows"],"latest_commit_sha":null,"homepage":"","language":"Batchfile","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/rbaltrusch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-02-10T16:34:22.000Z","updated_at":"2022-06-22T20:28:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b26d8f2-20b4-4e97-a7cc-2c6e1403139b","html_url":"https://github.com/rbaltrusch/batest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fbatest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fbatest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fbatest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fbatest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbaltrusch","download_url":"https://codeload.github.com/rbaltrusch/batest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fbatest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259143579,"owners_count":22811904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["batch","batch-file","batchfile","framework","lightweight","test-automation","testing","tests","unit-testing","windows"],"created_at":"2024-11-12T20:14:24.095Z","updated_at":"2025-06-10T20:04:26.989Z","avatar_url":"https://github.com/rbaltrusch.png","language":"Batchfile","readme":"[![Run Tests](https://github.com/rbaltrusch/batest/actions/workflows/run_tests.yml/badge.svg)](https://github.com/rbaltrusch/batest/actions/workflows/run_tests.yml)\n![version](https://img.shields.io/badge/version-1.0.0-blue)\n[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n\n# Batest\n\nBatest is a lightweight batchfile unit testing framework, shipping with an [assert](https://github.com/rbaltrusch/batest/tree/master/README.md/#assertions) statement to make testing batchfiles easy. It generates a simple HTML test report containing the results after every run.\n\n![Screenshots of the test reports](https://github.com/rbaltrusch/batest/blob/master/batest/media/screenshot.png?raw=true)\n\n## Getting started\n\nTo get a copy of this repository, simply open up git bash in an empty folder and use the command:\n\n\t\t$ git clone https://github.com/rbaltrusch/batest\n\nTo call batest from anywhere in the command line, add it to the Windows PATH. Alternatively, navigate to the folder containing the *batest.bat* file to run batest without modifying your Windows PATH.\n\n## How to use\n\nBatest ships with an [assert](https://github.com/rbaltrusch/batest/tree/master/README.md/#assertions) statement (located in the same folder as *batest.bat*), which should be used in the test files you define. Information on the functionality provided with the *assert* statement can be found [here](https://github.com/rbaltrusch/batest/wiki/assert).\n\nTo test the current folder with batest, simply run one of the following from the command line:\n```batch\nbatest\nbatest .\n```\n\nTo test a specific folder, run one of the following from the command line, either specifying relative or absolute paths:\n```batch\nbatest \"../script_folder\"\nbatest \"D:/some_folder/script_folder\"\n```\n\nFor more help directly on the command line, run:\n```\nbatest help\n```\n\n### Folder structure\n\nThe folder containing the scripts to be tested should contain a subfolder called *tests* (as in the example folder structure below).\nThe *tests* folder must contain all test files that test the scripts under test.\n\n```\n+---scripts1\n|   \\---tests\n\\---scripts2\n    \\---tests\n```\n\n### Test file naming\n\nAll test files must end with the suffix *_test* to be recognized and run by batest.\nFor example, *some_test.bat* would be recognized and run by batest, but *test_something.bat* would not be.\n\nTo list all test files recognized by batest under a path without actually running them, use the *--list [-l]* option, as in the example below:\n```batch\nbatest --list \"path/to/folder\"\n```\n\n### Assertions\n\nThe *assert.bat* script shipping with batest supports much of the functionality of the Batch IF statement.\n\nThe general syntax for the assert call is:\n\n```batch\ncall assert operand1 operator operand2 errormessage\n```\n\nSome examples of various assert statements and whether they are expected to fail or to pass:\n\n```batch\n:: should pass, 1 equals 1\ncall assert 1 EQU 1 \"my message\"\n```\n\n```batch\n::should pass if file.txt exists\ncall assert exist file.txt \"file is missing\"\n```\n\n```batch\n::should pass 1 is not greater than 2\ncall assert NOT 1 GEQ 2 \"error message\"\n```\n\nPassing assert statements set ERRORLEVEL to 0, failing ones to 1.\n\nMore help is available in the [wiki](https://github.com/rbaltrusch/batest/wiki/assert) or directly in the command line:\n\n\tassert help\n\n### CI/CD\n\nBatest can also be used to test code automatically using services such as Github Actions. A local example of this can be found in the batest [test workflow](https://github.com/rbaltrusch/batest/tree/master/.github/workflows/run_tests.yaml), and an example of a third-party repository testing with batest can be found [here](https://github.com/rbaltrusch/objectbatch/tree/master/.github/workflows/run_tests.yaml).\n\n### More information\n\nFor more information on the use of batest, assert, and the folder structure, please have a look at the [examples](https://github.com/rbaltrusch/batest/tree/master/examples) and the [wiki](https://github.com/rbaltrusch/batest/wiki).\n\n## Contributions\n\nAny contributions, such as additional features, bugfixes, or documentation are much appreciated. Contribution guidelines are specified in [CONTRIBUTING.md](https://github.com/rbaltrusch/batest/blob/master/CONTRIBUTING.md).\n\n## License\n\nThis repository is open-source software available under the [MIT license](https://github.com/rbaltrusch/batest/blob/master/LICENSE).\n\n## Contact\n\nPlease raise an issue for code changes. To reach out, please send an email to richard@baltrusch.net.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaltrusch%2Fbatest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbaltrusch%2Fbatest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaltrusch%2Fbatest/lists"}