{"id":23151123,"url":"https://github.com/4kills/cliapptestingframework","last_synced_at":"2025-07-24T00:03:30.972Z","repository":{"id":104145070,"uuid":"237693559","full_name":"4kills/CLIAppTestingFramework","owner":"4kills","description":"A testing framework for conveniently black-box testing a Java CLI app.","archived":false,"fork":false,"pushed_at":"2020-07-17T14:58:59.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T21:44:38.983Z","etag":null,"topics":["black-box-te","cli","cli-app","java","testing","testing-framework","testing-library"],"latest_commit_sha":null,"homepage":"","language":"Java","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/4kills.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-01T23:38:49.000Z","updated_at":"2020-07-17T14:59:27.000Z","dependencies_parsed_at":"2023-07-05T07:32:09.808Z","dependency_job_id":null,"html_url":"https://github.com/4kills/CLIAppTestingFramework","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/4kills/CLIAppTestingFramework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4kills%2FCLIAppTestingFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4kills%2FCLIAppTestingFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4kills%2FCLIAppTestingFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4kills%2FCLIAppTestingFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4kills","download_url":"https://codeload.github.com/4kills/CLIAppTestingFramework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4kills%2FCLIAppTestingFramework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266769809,"owners_count":23981445,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["black-box-te","cli","cli-app","java","testing","testing-framework","testing-library"],"created_at":"2024-12-17T18:27:54.857Z","updated_at":"2025-07-24T00:03:30.878Z","avatar_url":"https://github.com/4kills.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CLIAppTestingFramework\n\nThis library comprises a small collection of classes for conviently black-box testing a Java CLI app.\n\nPlease note that this project was originally created as a support tool for the \nfinal examinations in the programming module at the [Karlsruhe Institute of Technology (KIT)](https://www.kit.edu/english/index.php), Germany; winter semester 2019/20. \nIt was designed to help students conduct integration, as well as acceptance tests, in order to aid them in finding bugs in their software before submitting it for evaluation.  \nOriginally, this library was **not** designed as a \u003cins\u003egeneral purpose\u003c/ins\u003e testing framework. \n\n# Getting started:\n\nFor now you can either integrate the repo into your own project or just [download](https://github.com/4kills/CLIAppTestingFramework/releases) the library as .jar\nfrom the releases section.  \n\n**IMPORTANT (especially for students at KIT): Use the edu.kit.informatik.Terminal provided with \u003cins\u003ethis\u003c/ins\u003e project for your terminal I/O.**\nThis is both convenient, so you don't have to integrate the Terminal class anymore, and it \nensures \u003cins\u003esmooth operation\u003c/ins\u003e by this package. \n\n# Usage:\n \nThe following example elaborates on the usage of this package. You only need a hook to your application's main method in order to test it thoroughly. \n\n```java\nimport net._4kills.kit.clitester.*;\nimport org.junit.jupiter.api.*;\n\nimport net._4kills.kit.somepackage.Main;\n\nimport java.util.function.Consumer;\n\nclass MainTest {\n    @Test\n    void someTest () {\n        // the main method of your application. If you import the package, Main.main(e) is sufficient. \n        Consumer\u003cString[]\u003e mainMethod = (e) -\u003e net._4kills.kit.somepackage.Main.main(e);\n\n        // tests the given application against the provided commands in the provided order.\n        // Thus 'lol' is fed first to the application, followed by 'start  torus' etc.\n        // The result contains all the outputs of the application to stdout.\n        Result actual = Tester.testAllCmds(mainMethod, \"lol\", \"start  torus\", \"badg\", \"start torus\", \"quit\");\n\n        // now you can declare your expected results. The Result.ERR matches any output beginning with \"Error, \".\n        // So in this example we expect 3 errors followed by exactly one \"OK\" output.\n        // After that we expect the app to exit due to the \"quit\" command, so there shouldn't be any further output!\n        Result expected = new Result(Result.ERR, Result.ERR, Result.ERR, \"OK\");\n\n        // finally the assertEquals tests if the actual and expected result are equal, in the sense that\n        // all their entries are the same except for error-msgs in the form of \"Error, \".\n        Assertions.assertEquals(expected, actual);\n    }\n\n    @Test\n    void someOtherTest () {\n        // we can also test our application by providing additional command line arguments that will be\n        // given to the main application.\n        String[] args = new String[] {\"argument1\", \"argument2\"};\n        // even though it is strongly recommanded to always use a \"quit\" call at the end you don't need to\n        // call it explicitly! If you don't call it the main method will timeout after the period specified in\n        // Tester.getTimeout(). Use Tester.setTimeout() so specify a custom timeout. \n        Result actual = Tester.testAll(Main::main, args, \"lol\", \"start  torus\", \"badg\", \"bs\", \"bs2\");\n        //                                 ^\n        //                                 |\n        // You can also just pass the main method as method reference.\n\n        // this time we expect 5 errors, but instead of having to type them all out we can use the following overload:\n        Result expected = new Result(5);\n        // = new Result(Result.ERR, Result.ERR, Result.ERR, Result.ERR, Result.ERR);\n\n        // There is also a mixed constructor that first takes n errors and then other result entries:\n        // Result expected = new Result(3, \"OK\");\n        // = new Result(Result.ERR, Result.ERR, Result.ERR, \"OK\");\n\n        // With junit 5 we can even see the actual results and the expected ones if the tests fail.\n        Assertions.assertEquals(expected, actual);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4kills%2Fcliapptestingframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4kills%2Fcliapptestingframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4kills%2Fcliapptestingframework/lists"}