Git Product home page Git Product logo

kuspia / stress-testing Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 7.33 MB

Do the stress testing of test cases and compare the differences of outputs produced by two .cpp files on the website https://text-compare.com/, using just one click.

C++ 91.71% Python 8.16% Batchfile 0.13%
python selenium browser-automation stress-testing debugging-tool software-testing-tools brute-force-vs-optimal hacktoberfest

stress-testing's Introduction

Powerful tool for stress testing of test cases in competitive programming and software development

This tool has been developed to do the stress testing of test cases and compare the differences of outputs produced by two .cpp files on the website https://text-compare.com/.

Where we can use it ?

  1. Suppose you have written a code using brute force approach which is correct and you have also written a optimal solution which may or may not be 100% correct so what we want is to compare it with different random test cases and quickly observe the differences if any. Hence this tool aids you easily and help you to do faster debugging.
  2. If you are into competitive programming of course we need to debug our solution while we are up solving the problems that we failed to solve during contest, hence one can copy some correct code of some user from the contest website let's say it is a optimal code and our incorrect code that was giving us WA as brute code. Now again we have two .cpp codes whose output we want to compare which can be done via this tool.
  3. One can also use this tool during software testing and development.

Imagine if you don't have this tool then manually you need to run two .cpp codes everytime and then supply inputs on the terminal by typing it. So just think when you are done doing this all you need to observe both o/p files carefully to notice any differences. Clearly this is really hectic and obviously there are chances that we may miss some differences and ultimately ending up getting tierd.

How to use it ?

It's very simple to use however little bit complicated to structure the files but if you follow line by line you won't miss it.

Somewhere put the testing folder with it all files inside it and copy the path of testing folder and make three changes in the files present inside the testing folder as shown:

h1.h for #define _2 and #define _1 set path to your path.

chk.py here open it and make the change at line 4 by replacing the path with your own path.

chk.py for this line options.add_argument("user-data-dir=C:\\Users\\1kusp\\AppData\\Local\\Google\\Chrome\\User Data\\Default") replace 1kusp with your name

You are done !! now the structuring of file has been set and tool is ready to be used.

I will demonstrate it for a codechef problem:

https://www.codechef.com/COOK140B/problems/DIGSMPAR

Suppose your solution: https://www.codechef.com/viewsolution/61889412 (let's say you want to test your code aganist someone's code who has written it correct; you know your code is not correct and you just want to know for which test cases it fails since you have manually tried too much for debugging and now you want some automation)

Suppose someone's solution: https://www.codechef.com/viewsolution/61887842 (you know this is optimal and 100% correct)

Now we need to modify three files as shown for above problem inside the testing directory

You are done !! now you are one click away

Run test_case_generator.cpp to generate o/p file named as in.txt or you may manually put test cases if you wish.

Execute tester.bat script

Just wait and see you will see a automated chrome window will open that will open a website and will display the differences after few seconds.

Note:: Your left side window dispaly the optimal/correct o/p while right side shows brute/incorrect o/p on the website.

stress-testing's People

Contributors

kuspia avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

raxvab

stress-testing's Issues

Lag while loading a big text file

While text_file of greater size gets populated on the website text boxes via selenium commands, I notice it is taking a considerable time amount,

Any suggestions or optimizations are appreciated.

Adding generic test cases format for the file test_case_generator

This is a kind of feature request where we can add generic test cases format for the file test_case_generator.cpp file.
Example:

1.
T
n
A1 A2 ... An
2.
n
A1 A2 ... An
B1 B2 ... Bn
3.
n m
A1 A2 ... An
B1 B2 ... Bm
4.
T
n
A1 A2 ... An [where every a_i is distinct]
5.
T
n m 
M [where M is a matrix of size n*m]

I have just put a few formats one can think many and provide neat documentation here on this repo and display documentation link when a user executes the test_generator file, if the type is found he can simply choose a type number, or else he has to write the .cpp file on his own.

I want to make it CLI-based shows the test case type available already so that the user can just choose and generate it without writing code for a common test cases format, moreover from CLI user can provide total test cases, constraints, etc.

Finding the test case where mismatch occured

Feature request:

Some piece of code that can fetch the mismatch from the website and then make a decision over the test case that got failed to produce exact o/p.

Note:: If all tcs are not producing an equal amount of lines as their o/p it will be difficult to analyze which o/p belongs to which tc hence as of now one can write a code snippet just for the uniform case.

so it should be like this

python chk.py -nu nu flags define nonuniform tcs so in that case user has to check it from the website itself
else
python chk.py for this command it should itself analyze the website and close the browser immediately and then build a text file in a testing directory with the name diff.txt showing the tcs that has differences, and then the text file should automatically open up for the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.