官术网_书友最值得收藏!

Integration tests

Checking whether an Add function really adds a and b is nice, but does not really give you an indication that the system as a whole works as well. As said, unit tests only test small and isolated units of code and should not interact with external components (external components are mocked). That is why you will want integration tests as well. Integration tests test whether the system as a whole operates as expected. We need to know whether a record can indeed be saved in and retrieved from a database, that we can request some data from an external service, and that we can log to some file on the filesystem. Or, more practically we can check whether the frontend that was created by the frontend team actually fits the backend that was created by the backend team. If these two teams have had any problems or confusion in communication, the integration tests will, hopefully, sort that out.

Last year, we created a service for a third party who wanted to interface with a system we wrote. The service did not do a lot basically it took the received message and forwarded it to another service that we used internally (and wasn't available outside of the network). The internal service had all of the business rules and could read from, and write to, a database. Furthermore, it would, in some cases, create additional jobs that would be put on a (asynchronous) queue, which is yet another service. Last, a fourth service would pick up any messages from the queue and process them. In order to process a single request, we potentially needed five components (external service, internal service, database, queue, and queue processor). The internal service was thoroughly unit tested, so the business rules were covered. However, that still leaves a lot of room for errors and exceptions when one of the components is not available or has an incompatible interface.

主站蜘蛛池模板: 囊谦县| 噶尔县| 防城港市| 沅陵县| 香河县| 格尔木市| 广南县| 宿松县| 三原县| 大连市| 沈丘县| 棋牌| 松原市| 清丰县| 岐山县| 耿马| 七台河市| 太康县| 鄂伦春自治旗| 大厂| 砀山县| 犍为县| 祁连县| 新巴尔虎左旗| 浠水县| 吉林市| 长春市| 东乡族自治县| 和龙市| 平遥县| 大埔区| 英山县| 扎赉特旗| 察隅县| 枞阳县| 祥云县| 江都市| 临沧市| 白城市| 霞浦县| 永登县|