center-randomize icon indicating copy to clipboard operation
center-randomize copied to clipboard

[WIP] optimize code and add tests

Open krishna-parajuli opened this issue 10 months ago • 5 comments

krishna-parajuli avatar Apr 21 '24 03:04 krishna-parajuli

Since it's WIP, it'd be great to use the pytest, the project intends to use pytest for testing @krishna-parajuli , there is now pytest config as well.

horrormyth avatar Apr 21 '24 08:04 horrormyth

@krishna-parajuli If possible, can you create a PR for the test configuration so that it can be merged and used by others?

ashiishme avatar Apr 22 '24 20:04 ashiishme

@krishna-parajuli thank you for taking lead on writing tests but the changes so far seem to be very detailed unit tests. Can we focus on writing tests that test the functionality first? Please see my proposal in this comment - https://github.com/moest-np/center-randomize/pull/11#issuecomment-2068393514

Please create a test framework that bootstraps running the code and makes the output available to test methods. We can then divide writing specific test cases per each requirement among other devs.

cc: @horrormyth

sapradhan avatar Apr 24 '24 01:04 sapradhan

@krishna-parajuli thank you for taking lead on writing tests but the changes so far seem to be very detailed unit tests. Can we focus on writing tests that test the functionality first? Please see my proposal in this comment - #11 (comment)

Please create a test framework that bootstraps running the code and makes the output available to test methods. We can then divide writing specific test cases per each requirement among other devs.

cc: @horrormyth

I agree with @sapradhan here, with a strong note that detailed unit tests for each function are necessary, the main reason being that these could be used elsewhere. We can argue that reusability is minimal in this project, but still, it would be good to go in that direction. Anyhow, for brevity, those functions could then be battle-tested from the main function that actually calls them with functionality/cases in mind. One advantage of this is that we don't necessarily need to provide expected fixtures for each of the functions; basically, whoever creates one writes the tests for it. The test sets of main/whatever_we_call should then cover all the intended test cases with the expected output that @sumanashrestha has mentioned and/or any corner cases. With that being said, and TLDR, it would be good to have the expected fixtures ready.

horrormyth avatar Apr 24 '24 22:04 horrormyth

@horrormyth @ashiishme @krishna-parajuli @sapradhan I have raised a PR that tests the functionality of the program. here https://github.com/moest-np/center-randomize/pull/89. It would be nice to add a tests folder and add unit tests and other tests there so that every PR will do a Build and produce the report before merge for further request upto you guys.

tests
|---units
|--- smoke
|-- intgration 

Sample automated testing here. https://github.com/samurato/center-randomize/actions/runs/8911951792/job/24474346754 its failing unit tests that ran 10 times as per the requirements student allocation per school in center has to be less than 200 .

samurato avatar May 01 '24 15:05 samurato