Refactoring your code into an MVC design might be a good way to allow implementing unit tests more easily, since the data model is not tightly coupled to the UI in this case. You can test the model using a command line program since the model does not require a user interface.
Depending on how deeply you want to refactor, you could even package your model into a separate library that could allow testing outside of your application.
Bookmarks