g_b
g_b

Reputation: 12428

Integration tests vs Unit tests

I know this has been asked a lot of times, but this example one test confuses me. The test example here:

Testing Routes In ASP.NET MVC

Is this a unit or integration test? On the page it specifies it is a unit test but as I understand it, an integration test are tests that uses real dependencies. So is using the GlobalApplication.RegisterRoutes considered a dependency? So is this an integration test? I'm a bit confused to the extent of what a dependency is.

Upvotes: 0

Views: 76

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

This is a unit test of a particular functionality of your application: the routes that you have defined.

So is using the GlobalApplication.RegisterRoutes considered a dependency?

No, that's the subject under test - it's what you are testing. A dependency would be something that this subject depends on in order to work. It is this dependency that can be either mocked (in a unit test) or just using the actual object (in an integration test). For example if your routes were dependent on some database lookup operation then, if you don't mock this db call, you would be writing an integration test.

Upvotes: 1

Related Questions