Exactly what is integration testing - compared with unit

前端 未结 5 1948
广开言路
广开言路 2021-02-01 14:18

I am starting to use unit testing in my projects, and am writing tests that are testing at the method/function level.

I understand this and it makes sense.

But,

5条回答
  •  再見小時候
    2021-02-01 15:02

    Unit testing is where you are testing your business logic within a class or a piece of code. For example, if you are testing that a particular section of your method should call a repository your unit test will check to make sure that the method of the interface which calls the repository is called the correct number of times that you expect, otherwise it fails the test.

    Integration testing on the other hand is testing that the actual service or repository (database) behavior is correct. It is checking that based on data you pass in you retrieve the expected results. This ties in with your unit tests so that you know what data you should retrieve and what it does with that data.

提交回复
热议问题