Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integration Testing vs. Unit Testing

I've recently started reading The Art of Unit Testing, and the light came on regarding the difference between Unit tests and Integration tests. I'm pretty sure there were some things I was doing in NUnit that would have fit better in an Integration test.

So my question is, what methods and tools do you use for Integration testing?

like image 560
grefly Avatar asked Mar 14 '11 15:03

grefly


People also ask

What is the difference between integration testing and unit testing?

While unit tests always take results from a single unit, such as a function call, integration tests may aggregate results from various parts and sources. In an integration test, there is no need to mock away parts of the application. You can replace external systems, but the application works in an integrated way.

Can we do integration testing without unit testing?

Integration tests should only verify that several components are working together as expected. Whether or not the logic of the individual components is accurate should be verified by unit tests.

What is the difference between unit testing and integration testing and end to end testing?

End to End: A helper robot that behaves like a user to click around the app and verify that it functions correctly. Sometimes called "functional testing" or e2e. Integration: Verify that several units work together in harmony. Unit: Verify that individual, isolated parts work as expected.


2 Answers

In my experience, you can use (mostly) the same tools for unit and integration testing. The difference is more in what you test, not how you test. So while setup, code tested and checking of results will be different, you can use the same tools.

For example, I have used JUnit and DBUnit for both unit and integration tests.

At any rate, the line between unit and integrations tests can be somewhat blurry. It depends on what you define as a "unit"...

like image 65
sleske Avatar answered Oct 08 '22 03:10

sleske


Selenium along with Junit for unit+integration testing including the UI

like image 30
anon Avatar answered Oct 08 '22 02:10

anon