Minitest
Programs from roupi
draft of unit testing program
only the minimum viable product

How does it work?


there are 3 main components the testApi, the manager, and the runner

testApi
it defines the the code that will print failures messages and assertion messages as well as the assertions function, it only have the bare minimum for now.

this component will be prepended on your test file so every function defined here will be available to use in your tests

the supported assertions:
assert(obj)
it asserts if the obj is true
assert_equal(obj1, obj2)
it asserts if the obj1 is equal to obj2

runner
it extracts every class ending with Test on your test file to generate a table of functions to be run.
it extracts a setup function to be ran before every test.
and it extracts the tests functions(every function on the test class that is not named setup).
on the end it will execute function by function, if there is a run time error it will stop every thing, maybe on the future i will implement a feature to try to test the rest even after an error.

this component will be appended to the final of your test file.

manager
it gives support functions to be used between the minitest(cli program) and the other components.

it have functions to increment assertions and failures stats, to later be accessed by minitest, it does it using support files, and it have functions to set the list of files to be tested and functions  to build and execute the tests.

the main function the the test_file, that gets the content of the test file and append and prepend the defined files in MiniManager.prepend  and  MiniManager.append, then it will build the file and launch it as well of printing the build errors and runtime error, it will do it for every file on MiniTest.files_to_run.

CLI


the minitest script that is the cli interface, it will have the installer in the future as well of generators to create the files and folder structure required, for now it is bare minimum and you will need to create a test folder and create the files on it manually.

Build


to use it you will need to put this project files on /home/guest/minitest t and compile minitest.src to /bin
(its easier to do it using https://www.greyrepo.xyz/posts/folder-parser and the export string provided on the bottom of the this page)
it will ship with a installer to set the libs and required files to installation folder in the future.

Usage


to use it you just run minitest test
you can use it on the examples folder to see it in action
just make sure to put this project files on /home/guest/minitest

output example:
Screenshot from 2022-04-03 03-44-10.png 24.3 KB
 


Files
Builds
Download build

Post's comments

post does not have comments.

You need to log in to write a comment.