Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do integration testing?

Tags:

There is so much written about unit testing but I have hardly found any books/blogs about integration testing? Could you please suggest me something to read on this topic?

What tests to write when doing integration testing? what makes a good integration test? etc etc

Thanks

like image 616
StackUnderflow Avatar asked Mar 16 '10 23:03

StackUnderflow


People also ask

What is integration testing with example?

This type of testing follows the natural control flow hierarchy, i.e., top to bottom. For example, you have a fitness app with four modules – A login page, a profile page, a workout page, and a payment page. The testing of the application will start from the crucial top-level module.

Which tool is used for integration testing?

Citrus. It is the most commonly used integration testing tool, which is a test framework and written in the Java programming language.

Can we do integration testing manually?

Manual and Automated Integration Testing After individual software units are created and checked by a development team, QA engineers start to inspect the combinations of different units, focusing first of all on the interfaces and connections between them.


2 Answers

Anything written by Kent Beck, father of both JUnit and SUnit, is a great place to start (for unit tests / test writing in general). I'm assuming that you don't mean "continuous integration," which is a process-based build approach (very cool, when you get it working).

In my own experience, integration tests look very similar to regular unit tests, simply at a higher level. More mock objects. More state initialization.

I believe that integration tests are like onions. They have layers.

Some people prefer to "integrate" all of their components and test the "whole" product as an the "integration" test. You can certainly do this, but I prefer a more incremental approach. If you start low-level and then keep testing at higher composition layers, then you will achieve integration testing.

like image 173
pestilence669 Avatar answered Sep 21 '22 12:09

pestilence669


Maybe it is generally harder to find information on integration testing because it is much more specific to the actual application and its business use. Nevertheless, here's my take on it.

What applies to unit-tests also applies to integration tests: modules should have an easy way to mock their externals inputs (files, DB, time...), so that they can be tested together with the other unit-tests.

But what I've found extremely useful, at least for data-oriented applications, is to be able to create a "console" version of the application that takes input files that fully determine its state (no dependencies on databases, network resources...), and outputs the result as another file. One can then maintain pairs of inputs / expected results files, and test for regressions as part of nightly builds, for example. Having this console version allows for easier scripting, and makes debugging incredibly easier as one can rely on a very stable environment, where it is easy to reproduce bugs and to run the debugger.

like image 42
small_duck Avatar answered Sep 21 '22 12:09

small_duck