{"id":16199073,"url":"https://github.com/aashutoshrathi/testcase-generator","last_synced_at":"2025-10-05T15:29:26.157Z","repository":{"id":37937352,"uuid":"105375545","full_name":"aashutoshrathi/Testcase-Generator","owner":"aashutoshrathi","description":"⚡️ Handy script for HackerRank, HackerEarth and CodeChef TCs Generation.","archived":false,"fork":false,"pushed_at":"2025-03-01T04:04:01.000Z","size":9629,"stargazers_count":105,"open_issues_count":9,"forks_count":55,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T19:09:12.429Z","etag":null,"topics":["cases","hackerrank","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://tcgen.aashutosh.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/aashutoshrathi.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}},"created_at":"2017-09-30T14:30:25.000Z","updated_at":"2025-03-01T04:03:57.000Z","dependencies_parsed_at":"2023-01-20T18:01:59.202Z","dependency_job_id":"ff01389c-d343-4ea0-8a6d-c33ad8025651","html_url":"https://github.com/aashutoshrathi/Testcase-Generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashutoshrathi%2FTestcase-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashutoshrathi%2FTestcase-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashutoshrathi%2FTestcase-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashutoshrathi%2FTestcase-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aashutoshrathi","download_url":"https://codeload.github.com/aashutoshrathi/Testcase-Generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"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":["cases","hackerrank","testing","testing-tools"],"created_at":"2024-10-10T09:15:44.934Z","updated_at":"2025-10-05T15:29:26.069Z","avatar_url":"https://github.com/aashutoshrathi.png","language":"Python","readme":"# Testcase Generator\n\n[\u003cimg src=\"https://image.flaticon.com/icons/svg/180/180867.svg\" align=\"right\" width=\"100\"\u003e](#)\n\n[![](https://img.shields.io/travis/aashutoshrathi/Testcase-Generator?style=for-the-badge)](https://travis-ci.org/aashutoshrathi/Testcase-Generator)\n\nHandy script to generate Test Cases for [HackerRank](https://www.hackerrank.com), [HackerEarth](https://www.hackerearth.com) and [CodeChef](https://www.codechef.com) Problems\n\nAre you a Problem Author?\nThe toughest part of creating a problem is creating tricky, correct and constrained Test Cases.\nWell, here is a handy **Python** Script, for your respective logic (solution).\n\n# Table of Contents\n\n- [Testcase Generator](#testcase-generator)\n- [Table of Contents](#table-of-contents)\n- [Mentions](#mentions)\n- [Supported Languages](#supported-languages)\n- [Install](#install)\n  - [How to Use ? 😃](#how-to-use--)\n  - [How it Works ? 🤔](#how-it-works--)\n  - [Setup using Docker 🐳](#setup-using-docker-)\n  - [Running Tests ✅](#running-tests-)\n- [FAQ 📃](#faq-)\n- [Contributors ✨](#contributors-)\n- [Stargazers over time 📈](#stargazers-over-time-)\n\n# Mentions\n\n-   [Blog post](https://medium.com/@agarwalrounak/my-nwoc-njack-winter-of-code-2018-experience-badf30b9c02d) on experince in NWoC 2018 by Rounak Agarwal.\n-   Selected as project in [GSSoC 2019](https://www.gssoc.tech/projects.html)\n-   Selected as project in [NJACKWinterOfCode 2018](\u003c[https://github.com/NJACKWinterOfCode/HackerRank-Test-Case-Generator](https://njackwinterofcode.github.io/)\u003e)\n\n# Supported Languages\n\nThe following languages are supported for testcase generation:\n\n-   [C](/tc_generator/logic.c)\n-   [C++](/tc_generator/logic.cpp)\n-   [Java](/tc_generator/logic.java)\n-   [Python](/tc_generator/logic.py)\n-   [C#](/tc_generator/logic.cs)\n-   [Go](/tc_generator/logic.go)\n\n# Install\n\n## How to Use ? 😃\n\n-   Clone the repository `$ git clone https://github.com/aashutoshrathi/Testcase-Generator.git`\n\n-   Create a virtual environment `$ virtualenv venv ` ([click here](https://stackoverflow.com/questions/14604699/how-to-activate-virtualenv) to read about activating virtualenv)\n    -   #### Activate virtualenv (Linux)\n    ```sh\n      $ source ./venv/bin/activate\n    ```\n    -   #### Activate virtualenv (Windows)\n    ```sh\n       $ cd venv/Scripts/\n       $ activate\n    ```\n-   Install requirements and modules\n\n```sh\n   $ pip install -r requirements.txt\n   $ pip install -e .\n```\n\n-   Change directory to `tc_generator `\n\n```sh\n   $ cd tc_generator/\n```\n\n-   **Edit the logic file of the language of your choice with the code for which you want to generate TCs**\n    NOTE: Make sure to keep the classname as '_logic_' in java so that it can compile to '_logic.class_'\n-   **Edit the Input area in `tc_gen.py` according to the input format you wish to generate**\n-   Run the project\n\n```sh\n   $ python tc_gen.py\n```\n\n-   Enter your choice of language when prompted\n-   Enter the choice of platform when prompted\n-   The input and output files would be generated and stored in `test-cases.zip` for HackerRank \u0026 HackerEarth and `test-cases` directory for CodeChef.\n\n**Tip:** If you're creating testcases for [CodeChef](https://codechef.com) then you can validate that the input sequence is generated according to the constraints using [this validator file](https://gist.github.com/thepushkarp/214402befde421b052443c0560991621). 😉\n\n## How it Works ? 🤔\n\n![Demo](demo3.gif)\n\n## Setup using Docker 🐳\n\n```sh\n  docker build . --tag=tcgen\n  docker run -p 4000:80 tcgen\n```\n\n## Running Tests ✅\n\n-   Change Directory to `Testcase-Generator`\n\n```sh\n  $ cd Testcase-Generator/\n```\n\n-   Install requirements and modules\n\n```sh\n   $ pip install -r requirements.txt\n   $ pip install -e .\n```\n\n-   Run `pytest`\n\n```sh\n  $ pytest\n```\n\n-   If no tests fail, the generator is working correctly.\n\n# FAQ 📃\n\n1. **How do I compile with a different version of C++?**\n   Changing Line 22 in [`lang_compiler.py`](https://github.com/aashutoshrathi/Testcase-Generator/blob/master/tc_generator/lang_compiler.py) to the line below will compile the file with C++ 17. You can replace the '17' with '11', '14' or '20' in the line below to compile with the respective versions.\n\n```py\n'compile': ['g++', f'{CMD}.cpp', '-o', CMD, '-std=c++17']},\n```\n\n1. **What line ending does it saves the testcases in?**\n   It saves the files with Linux style file endings (LF) in both Linux and Windows (unless the file is opened and saved again in WIndows that may change it to CRLF).\n\n# Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://aashutosh.dev\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/21199234?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAashutosh Rathi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#tool-aashutoshrathi\" title=\"Tools\"\u003e🔧\u003c/a\u003e \u003ca href=\"#projectManagement-aashutoshrathi\" title=\"Project Management\"\u003e📆\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/pulls?q=is%3Apr+reviewed-by%3Aaashutoshrathi\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/issues?q=author%3Aaashutoshrathi\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=aashutoshrathi\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/thepushkarp\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/42088801?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePushkar Patel\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-thepushkarp\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=thepushkarp\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/issues?q=author%3Athepushkarp\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=thepushkarp\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/prithaupadhyay\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/21213021?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePritha Upadhyay\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-prithaupadhyay\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=prithaupadhyay\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/issues?q=author%3Aprithaupadhyay\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=prithaupadhyay\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.vishnu.codes\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/10045752?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eVishnu Ramana\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=vishnuramana\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://itspugle.com\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/22669894?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eTim Rossback\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=timrossback\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://geekscreed.com\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/5305600?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSasivarnan R\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=sasivarnan\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/gerardogalvez\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/8509232?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGerardo Gálvez\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=gerardogalvez\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/dastgirp\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/2889931?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDastgir\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=dastgirp\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://www.sai-adarsh.ml/\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/21096774?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSai Adarsh S\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=Sai-Adarsh\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/rounak-agarwal/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/38394281?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRounak Agarwal\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/aashutoshrathi/Testcase-Generator/commits?author=agarwalrounak\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://medium.com/@agarwalrounak/my-nwoc-njack-winter-of-code-2018-experience-badf30b9c02d\" title=\"Blogposts\"\u003e📝\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n# Stargazers over time 📈\n\n[![Star History Chart](https://api.star-history.com/svg?repos=aashutoshrathi/Testcase-Generator\u0026type=Date)](https://star-history.com/#aashutoshrathi/Testcase-Generator\u0026Date)\n\n\u003cp align=\"center\"\u003e Made with ❤ by \u003ca href=\"https://github.com/aashutoshrathi\"\u003eAashutosh Rathi\u003c/a\u003e\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashutoshrathi%2Ftestcase-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faashutoshrathi%2Ftestcase-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashutoshrathi%2Ftestcase-generator/lists"}