Testcase Generator

Handy script to generate Test Cases for HackerRank, HackerEarth and CodeChef Problems

Are you a Problem Author? The toughest part of creating a problem is creating tricky, correct and constrained Test Cases. Well, here is a handy Python Script, for your respective logic (solution).

Table of Contents


Supported Languages

The following languages are supported for testcase generation:


How to Use ? 😃

   $ pip install -r requirements.txt
   $ pip install -e .
   $ cd tc_generator/
   $ python tc_gen.py

Tip: If you’re creating testcases for CodeChef then you can validate that the input sequence is generated according to the constraints using this validator file. 😉

How it Works ? 🤔


Setup using Docker 🐳

  docker build . --tag=tcgen
  docker run -p 4000:80 tcgen

Running Tests ✅

  $ cd Testcase-Generator/
   $ pip install -r requirements.txt
   $ pip install -e .
  $ pytest


  1. How do I compile with a different version of C++? Changing Line 22 in 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.
'compile': ['g++', f'{CMD}.cpp', '-o', CMD, '-std=c++17']},
  1. What line ending does it saves the testcases in? 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).

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Aashutosh Rathi

🔧 📆 👀 🐛 💻

Pushkar Patel

🚧 ⚠️ 🐛 💻

Pritha Upadhyay

🚧 ⚠️ 🐛 💻

Vishnu Ramana


Tim Rossback


Sasivarnan R


Gerardo Gálvez




Sai Adarsh S


Rounak Agarwal

💻 📝

This project follows the all-contributors specification. Contributions of any kind welcome!

Stargazers over time 📈

Stargazers over time

Made with ❤ by Aashutosh Rathi