The Master Controller code splits its core functionality between "managers" with specific responsibilities, including handling boundary crossings to the View and to the Model/Model Controller. Each manager is housed in a container class. This is an excellent spot to introduce dependency injection for test components, as shown in the ManagerControllerSample.java below:
I created a test framework that allowed for each integration test to determine for each manager whether it would be implemented as a mock, using the standard implementation, or using a spied version of the standard implementation. With Dagger2, I was able to inject the appropriate component (test or production) at run-time. In Graph.java we see the dagger graph. IntegrationTestBase.java specifies the list of managers to mock and spy as seen in the call to initGraph(), and ManagerTestDataModule injects the appropriate manager type (standard, mock, or spy):
In the next post I will discuss an integration test that used this framework and a technique for synchronizing callbacks spanning thread boundaries.
Hello Rick Jones,
ReplyDeleteThe Article on Developing an Integration Test Framework is informative. It gives detailed information about it .Thanks for Sharing the information on Integration Test Framework .For More information check the detail of Integration testing check Software Testing Services