DEV Community

Cover image for Test Case Generator
Tanmay Khandelwal
Tanmay Khandelwal

Posted on

Test Case Generator

Generate test cases for Competitive Coding.

  • Visit Project here and download the zip file
  • For more convenience,
    1. right click on 'test_case.exe' after extraction.
    2. click on pin to start.
    3. Now the tool's icon is pinned to your start menu and can be used directly from there which saves the hussle of going inside the dist folder everytime you want to run the tool.

To be kept in mind:

  • This is a plug'n'play tool i.e. no installation is required
  • There could be a case when your web browser or windows defender shows a warning regarding security issue or virus detected and in that case, you would either have to pause your antivirus and/or windows defender for the time being before downloading(can be resumed right after downloading completes).
  • If the pc shows a warning similar to this "Operation did not complete because the file contains a virus or unwanted file", it is probably due to an issue with py2exe and pyinstaller which are used to convert the python program into an executable file. It can be overcome by allowing "insatallation from unknown sources" and setting it up as "Ask always" under the privacy settings.

About Project

  • This project is a combined application of Object Oriented Programming, Competitive coding and Tkinter toolkit.
  • I got the motivation to develop this project after I begun my competitive programming journey(not a great one yet though but working my way up gradually), there were many times when I saw people(including me and my friends) stuck on trying to struggle in thinking test cases when their program fails the submission, especially the case with beginners and that is the main reason this project is developed.
  • However, it is not advised to directly use this tool everytime without trying and thinking test cases on your own, but treat it like a hint to a problem, you should try to solve the problem first before looking up the hint and if you're unable to get ahead then it is advisable to go for the hint instead of just wasting more time. Treat this tool similarly.

Home Page:

Click on the desired type of Test Case.

Home page

Input Screen

Enter the constraints here

Make sure that none of the constraints is having values more than 107 and T*maximum_value_of_n/m/k <=107

This limit is applied because Outputs are in the form of arrays, and any array having size more than that would completely use up memory of
a standard PC and would cause it to hang. This issue is under consideration and would be soon dealt with.

Input Constraints Screen

Output Screen

Finally Output is shown.

Alt Text

On the output screen you can use multiple handy features as well like copy, regenerate new test case, change constraints
on single click.


Pre-requisites:

* To use codes apart from first release, 'tkinter' must be installed.

Challenges faced:

S.N. Issue Solution/proposed Solution Resolved or not
1. Application window appeared different on windows and Linux based system Manually designed the GUI similar to the Linux one ✔️
2. PC freezed when input constraints were too big Set lower and upper limit for constraints ✔️
3. Working on big input values split the test case in two or more parts and then concatenate them as strings to generate on large constraints OR Use Heap memory
4. Windows defender/Antivirus/Chrome virus check treated the file as malicious and blocked download Used py2exe instead of pyinstaller and uploaded zip of multiple files instead of --onefile ✔️
5. Code became Surprisingly long Converted whole program from simple functions and methods to OOPs ✔️

Journey of Development of this project:

  • I learned Tkinter a whole lot better while building this project compared to when I just learned and copy pasted code from tutorial.
  • Before this project, All I knew about OOPs was its definition, types and example and used them only for exam and interview purpose but with this project I have used them a lot thoroghly now and now undderstand every bit of what I earlier used to mug up. while developing this project I faced an unforeseen issue of working on a very very long code. In the starting phase when the program was all commands, functions and methods, the code was more than 1500 lines for just 5 types of test cases and that too without other additional features (like copy, regenerate, change constraints and others).
  • It started to be really inconvenient for me to traverse in that program from top to bottom every 5 minutes and it took a lot of time just to find what i was searching for to work upon. Then I thought of trying OOPs- Inheritance and Abstraction, because there were things which seemed like a little bit common for most of the test cases although it cost me a few more days just to get it done (change whole code in classes and methods), the code started to optimise and its length reduced drastically and within a week the program was less than half(600 lines approx) of what it was and that too with those additional buttons and features which currently are present.

Updates:

  • Support for Test cases for larger constraint values is being worked upon.
  • New test case types are being added continuously.

Top comments (1)

Collapse
 
dude901 profile image
Tanmay Khandelwal

Any suggestions or feedback are heartily welcome.