Integration vs Functional Testing

functional-testingintegration-testingintegration-teststddtesting

Alright….so this is driving me nuts as I'm trying to encourage the team to write more tests yet here I am unable to determine whether the following example is considered an integration or a functional test case.

Consider the following:

We have a simple web application which routes/exposes a number of JSON feeds. Each user request requires that our application query an external service via HTTP (on the backend) before performing some data transformations and then returning a serialized JSON response.

Using a 3rd party library, we're able to record every unique HTTP interaction which occurs on the backend and write it to the filesystem. These recordings are then "played back" allowing these query results to be treated as deterministic during testing.

My test case contains a single assertion. It's a just a string which contains the expected JSON response for a single feed. After we've initialize our application – we allow it to route a request before capturing the response and comparing it against the expected JSON.

1) Is this a functional test or an integration test?

2) If functional, then what exactly is the difference between "Big Bang Integration Testing and Functional Testing"?

Best Answer

1) Is this a functional test or an integration test?

Functional testing and integration testing are classifications of tests, and they are not mutually exclusive.

In this case it's both. Integration tests are by definition any test that is testing more than one component. It can be at a low level to test two classes that work together, or it can be tests that test the entire system as a whole.

Functional tests are tests that confirm a given system function. So if I have a requirement "the system shall persist users object in the database", the functional test could verify that requirement by starting the system, saving a user, stopping the system, starting it again, and verifying the user exists and has not changed.

If you're writing test cases from a requirement spec or from user stories, I would call your test cases "functional tests", but they are also classified as integration tests by nature.

2) If functional, then what exactly is the difference between "Big Bang Integration Testing and Functional Testing"?

From my understanding "big bang integration testing" is integration testing where all the components of the system are integrated and then tested. The goal of this test is to make sure all the components are integrating correctly and the app can start. The downside to this kind of testing is that a failure of a test case gives very little direction to where the bug is, so it's important to have lower level integration tests as well.

Your functional tests will probably also integrate all the components in the system before testing. But while big bang integration testing may look similar because the entire system is being started, they are conceptually different.

Related Topic