Exactly what is integration testing - compared with unit

Marty Wallace picture Marty Wallace · May 23, 2013 · Viewed 21.3k times · Source

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, what is integration testing? From what i read it moves the scope of testing up to test larger features of an application.

This implies that I write a new test suite to test larger things such as (on an e-commerce site) checkout functionality, user login functionality, basket functionality. So here i would have 3 integration tests written?

Is this correct - if not can someone explain what is meant.

Also, does integration test involve the ui (web application context here) and would employ the likes of selenium to automate. Or is integration testing still at the code level but tying together difference classes and areas of the code.

Answer

Knaģis picture Knaģis · May 23, 2013

Consider a method like this PerformPayment(double amount, PaymentService service);

An unit test would be a test where you create a mock for the service argument.

An integration test would be a test where you use an actual external service so that you test if that service responds correctly to your input data.