GSoC 2023 with OpenMRS | Coding Week 07
After successfully passing the Midterm evaluation, I was thrilled to continue working on my project. This week was all about taking my mentor’s feedback seriously and diving into writing tests for the OpenMRS Android SDK. Although I initially felt confused about the process, I soon realized the importance of testing and the value it brings to the development process.
Creating Test Cases:
To kickstart the testing process, I began by identifying the critical functionalities and components of the Android SDK that needed to be tested. By thoroughly understanding the SDK’s architecture, I could pinpoint the areas that required meticulous examination. Breaking down the SDK into smaller units allowed me to create specific test cases for each component.
Loading the Tools:
I explored various tools that can be used while unit testing the Android SDK code. I then decided to go with libraries like MockK, Robolectric (Which helped me run the tests on JVM and no need for emulator) and Dagger Hilt dependency injections.
Bug Discovery and Code Refactoring:
During the execution of unit tests for the Appointment Repository, I encountered numerous bugs within the Appointment Module. It was a valuable learning experience as it revealed areas of improvement and allowed me to enhance the functionality of the codebase.
Identifying these bugs emphasized the importance of thorough testing and validated the significance of the testing phase in the development process. By catching these issues early on, I could address them promptly and ensure a smoother user experience in the future.
In addition to fixing the bugs, I realized the need for refactoring the code to improve its overall efficiency and maintainability. Refactoring involves restructuring code without changing its external behavior, resulting in cleaner, more readable, and better-organized code.
With a clear understanding of the issues and the direction I wanted to take, I began refactoring the Appointment Repository. This involved analyzing the existing codebase, identifying areas for improvement, and implementing changes that would lead to a more seamless functioning of the repository.
Conclusion and Future Work:
In the course of my Google Summer of Code project, the significance of unit tests has become abundantly clear. The process of executing unit tests for the Appointment Repository highlighted the importance of thoroughly testing the Android SDK and continuously improving the codebase.
Moving forward, my focus will be on writing test cases for all major APIs in the SDK. This comprehensive testing will not only enhance the reliability of the SDK but also provide a solid foundation for future enhancements and additions. By prioritizing unit testing and code quality, I am committed to contributing to the success of the project and delivering an exceptional Android SDK.
Thank you for reading and stay tuned for week 8 progress :)
Connect with me on LinkedIn: www.linkedin.com/in/amshubham