Redundant tests for Manage Appointment Blocks

Dear guys,

I’m refactoring the tests regarding the Manage Appointment Blocks module since they are ignored, namely ManageProviderSchedulesTest.java, DeleteAppointmentBlockTest.java and AddEditAppointmentBlockTest.java. As I can see they are redundant, if we analyze the test method for each one of them, you notice that they are doing the same thing: create an appointment, edit it and delete it. ManagerProviderSchedulesTest appears to be the most comprehensive of all tests, my advice is to keep only this test and delete the others. We would benefit in many ways: easy maintenance, reduction of the overall testing execution time, etc. Let me know what you think of. In the meanwhile, I’ve also modified (minor modification) AppointmentBlocksPage.java because it wasn’t aligned with module state of the art (e.g, wrong locators) Thank you in advance

Having one class for the three tests is fine. Though i would have a separate method for create, edit, delete. That way, if a test fails, i have an answer from the method name regarding whether create, edit or delete is the one which has a bug.

I agree with you, although we slightly deviate from the advice “In general each class should contain one test method”.

Am fine with that, but i sometimes see it over kill to have so many classes with just one test method in each. :smile:

ok :slight_smile:

Just a comment about [quote=“domenico, post:3, topic:10041, full:true”] I agree with you, although we slightly deviate from the advice “In general each class should contain one test method”. [/quote]

The reason is that they can be easier run in parallel as each test class can be run in a separate fork.

Oh i see! Did i just miss that here? https://wiki.openmrs.org/display/docs/Testing+-+Revamped

There’s one sentence there:

If a test class has more than one test method, those methods will never run in parallel.

Not sure if it conveys the reasoning well enough :slight_smile:

Oh i see! Yes well conveyed! :wink:

Well, guys I din’t have the time to work on the tests. However, I’ll remove the redundant test, but I’ll keep the principle of having one test method in the test class. Thank you both.