142

Are functional testing and integration testing the same?

You begin your testing through unit testing, then after completing unit testing you go for integration testing where you test the system as a whole. Is functional testing the same as integration testing? You still taking the system as a whole and testing it for functionality conformance.

Graham Conzett
  • 7,984
  • 11
  • 52
  • 93
Mishthi
  • 1,659
  • 4
  • 15
  • 12
  • 1
    possible duplicate of [The Agile Way: Integration Testing vs Functional Testing or both? ](http://stackoverflow.com/questions/555899/the-agile-way-integration-testing-vs-functional-testing-or-both) – Pascal Thivent Sep 15 '10 at 19:43
  • See my answer here: http://stackoverflow.com/questions/2741832/unit-tests-vs-functional-tests/37564654#37564654 – Andrejs Aug 20 '16 at 10:46
  • 9
    I have to say this question represents what is wrong with this site. What is wrong with this question? How is it too broad? It's asking something VERY specific, related to programming. What is the differnce between something can even be represented mathmatically It just seems there is a huge number of really important, really relevant questions that ge shut down for inexplicable reasons. I know you serious SO people are going to tell me I'm wrong, but the fact these qustions are being fractured to sites like Quara.com prove I'm right. [Basically SO is abdicating market share]. – Jim Maguire Aug 14 '17 at 19:07
  • 1
    Related: [What's the difference between unit, functional, acceptance, and integration tests?](https://stackoverflow.com/q/4904096/3357935) – Stevoisiak May 18 '18 at 17:01
  • 2
    I agree with @JimMaguire: the question as asked is a "yes/no" question (plus explanation of why yes or no). I'm not seeing why it's considered not focused. – bob Feb 14 '20 at 22:44
  • 1
    @JimMaguire Can't agree more. Someone with a moderator stick decided that all questions should be in the format "*why doesn't my code compile??? here's a code dump that I've lifted from somewhere but don't understand. please tell me how to do my job*", and that open-ended questions that require thinking aren't suitable for SO. Wrong! – Abhijit Sarkar Aug 17 '20 at 23:09

11 Answers11

114

Integration testing is when you test more than one component and how they function together. For instance, how another system interacts with your system, or the database interacts with your data abstraction layer. Usually, this requires a fully installed system, although in its purest forms it does not.

Functional testing is when you test the system against the functional requirements of the product. Product/Project management usually writes these up and QA formalizes the process of what a user should see and experience, and what the end result of those processes should be. Depending on the product, this can be automated or not.

Pang
  • 8,605
  • 144
  • 77
  • 113
aceinthehole
  • 4,734
  • 9
  • 34
  • 53
  • 9
    Thanx...yes but in functional testing also when we are testing the system against the functional requirement that time also we are taking it as an integrated system.. And while performing functional tetsing we will also find out that how the diffrent units are working together so it can be thoght of as Integration testing... – Mishthi Sep 08 '10 at 18:32
  • 3
    Specially in our environment, we always considered unit test to be nunit test written against a single class, integration tests to be nunit tests or sql script tests that required more than class, or a database, or another system (usually requiring a full install) and functional tests are the test that QA runs or automated UI testing. – aceinthehole Sep 09 '10 at 01:51
  • 1
    Also, I'd say that if you haven't done integration testing prior to functional testing then you are doing both at the same time, and you are just going to find mistakes in the integration parts while you are testing functional requirements. – aceinthehole Sep 09 '10 at 01:57
  • Old but timeless – Mickelback Jul 12 '20 at 17:03
22

Functional Testing:

Yes, we are testing the product or software as a whole functionally whether it is functionally working properly or not (testing buttons, links etc.)

For example: Login page.

you provide the username and password, you test whether it is taking you to home page or not.

Integration Testing:

Yes, you test the integrated software only but you test where the data flow is happening and is there any changes happening in the database.

For example: Sending e-mail

You send one mail to someone, there is a data flow and also change in database (the sent table increases value by 1)


Remember - clicking links and images is not integration testing. Hope you understood why, because there is no change in database by just clicking on a link.

Hope this helped you.

Stevoisiak
  • 16,510
  • 19
  • 94
  • 173
jsborn17
  • 425
  • 1
  • 7
  • 12
  • 4
    Database is implementation detail of program state. Clicking on the link also can change program state. – alehro Mar 17 '17 at 13:08
  • @jsborn17 is integration testing applicable to a front-end application communicating with a API even tho we are not able to run the API? – Wancieho Jul 10 '18 at 14:25
9

This is an important distinction, but unfortunately you will never find agreement. The problem is that most developers define these from their own point of view. It's very similar to the debate over Pluto. (If it were closer to the Sun, would it be a planet?)

Unit testing is easy to define. It tests the CUT (Code Under Test) and nothing else. (Well, as little else as possible.) That means mocks, fakes, and fixtures.

At the other end of the spectrum there is what many people call system integration testing. That's testing as much as possible, but still looking for bugs in your own CUT.

But what about the vast expanse between?

  • For example, what if you test just a little bit more than the CUT? What if you include a Fibonacci function, instead of using a fixture which you had injected? I would call that functional testing, but the world disagrees with me.
  • What if you include time() or rand()? Or what if you call http://google.com? I would call that system testing, but again, I am alone.

Why does this matter? Because system-tests are unreliable. They are necessary, but they will sometimes fail for reasons beyond your control. On the other hand, functional tests should always pass, not fail randomly; if they are fast, they might as well be used from the start in order to use Test-Driven Development without writing too many tests for your internal implementation. In other words, I think that unit-tests can be more trouble than they are worth, and I have good company.

I put tests on 3 axes, with all their zeroes at unit-testing:

  1. Functional-testing: using real code deeper and deeper down your call-stack.
  2. Integration-testing: higher and higher up your call-stack; in other words, testing your CUT by running the code which would use it.
  3. System-testing: more and more unrepeatable operations (O/S scheduler, clock, network, etc.)

A test can easily be all 3, to varying degrees.

cdunn2001
  • 15,667
  • 7
  • 51
  • 42
  • functional tests always pass? or do you mean functional tests _should_ always pass? – aceinthehole Jul 10 '14 at 19:28
  • 1
    They should not fail randomly. When they fail, they should fail every time. E.g., they should not include calls to other hosts. Maybe they should be called *Behavioral Tests*? I don't know the best term. I just know that they are the most important tests, and they are typically overlooked in the wide gap between pure, fully mocked *unit tests* and high-level *system-integration tests*. – cdunn2001 Jul 10 '14 at 23:42
  • "They should not fail randomly." - The term there might be that they're "deterministic" – kleaver Jul 28 '20 at 20:53
9

Functional Testing: It is a process of testing where each and every component of the module is tested. Eg: If a web page contains text field, radio botton, Buttons and Drop down etc components needed to be checked.

Integration Testing: Process where the dataflow between 2 modules are checked.

raghuram
  • 91
  • 1
  • 1
6

I would say that both are tightly linked to each other and very tough to distinguish between them. In my view, Integration testing is a subset of functional testing.

Functionality testing is based on the initial requirements you receive. You will test the application behaviour is as expected with the requirements.

When it comes to integration testing, it is the interaction between modules. If A module sends an input, B module able to process it or not.

Naidu
  • 132
  • 1
  • 5
  • +1 for "Integration testing is a subset of functional testing" - my experience also show that such approach to tests are the most meaningful if you aim for a result fast. For example, in my test code I usually treat the system as a single integrated unit - I set up in-memory database and then feed my app MVC controllers with some test data and verify their response, and also verify the data in the database to be sure that all data validation has worked as expected, to avoid bugs when MVC controller returns correct response, but it is not actually passed correctly to the database layer. – JustAMartin Jan 11 '16 at 09:13
4

Integration testing - Integration testing is nothing but the testing of different modules. You have to test relationship between modules. For ex you open facebook then you see login page after entering login id and password you can see home page of facebook hence login page is one module and home page is another module. you have to check only relationship between them means when you logged in then only home page must be open not message box or anything else. There are 2 main types of integration testing TOP-DOWN approach and BOTTOM UP approach.

Functional Testing - In functional testing you have to only think about input and output. In this case you have to think like a actual user. Testing of What input you gave and what output you got is Functional testing. you have to only observe output. In functional testing you don't need to test coding of application or software.

Renato
  • 193
  • 1
  • 6
3

In a Functional testing tester focuses only Functionality and sub functionality of application. Functionality of app should be working properly or not.

In integration testing tester have to check dependency between modules or sub-modules.Example for modules records should be fetching and displayed correctly in another module.

Krunal
  • 51
  • 9
2

Integration Test:- When Unit testing is done and issues are resolved to the related components then all the required components need to integrate under the one system so that it can perform an operation. After combining the components of the system,To test that whether the system is working properly or not,this kind of testing is called as Integration Testing.

Functional Testing:- The Testing is mainly divided into two categories as 1.Functional Testing 2.Non-Functional Testing **Functional Testing:- To test that whether the software is working according to the requirements of the user or not. **Non-Functional Testing:- To test that whether the software satisfies the quality criteria like Stress Test,Security test etc.

Usually,Customer will provide the requirements for Functional Test only and for Non Functional test,Requirements should not be mentioned but the application necessarily perform those activity.

mohit sarsar
  • 169
  • 3
  • 8
2

Integration testing

  • It can be seen as how the different modules of the system work together.
  • We mostly refers to the integrated functionality of the different modules, rather different components of the system.
  • For any system or software product to work efficiently, every component has to be in sync with each other.
  • Most of the time tool we used for integration testing will be chosen that we used for unit testing.
  • It is used in complex situations, when unit testing proves to be insufficient to test the system.

    Functional Testing

  • It can be defined as testing the individual functionality of modules.
  • It refers to testing the software product at an individual level, to check its functionality.
  • Test cases are developed to check the software for expected and unexpected results.
  • This type of testing is carried out more from a user perspective. That is to say, it considers the expectation of the user for a type of input.
  • It is also referred as black-box testing as well as close-box testing
  • Shah
    • 493
    • 4
    • 10
    1

    Checking the functionality of the application is generally known as functional testing, where as the integration testing is to check the flow of data from one module to other. Lets take example of money transfer app.Suppose we have page in which we enter all the credentials and if we press transfer button and after that if we getting any success, Then this is functional testing. But in same example if we verify the amount transfer then it is integration testing.

    0

    Authors diverge a lot on this. I don't believe there is "the" correct interpretation for this. It really depends.

    For example: most Rails developers consider unit tests as model tests, functional tests as controller tests and integration tests as those using something like Capybara to explore the application from a final user's perspective - that is, navigating through the page's generated HTML, using the DOM to check for expectations.

    There is also acceptance tests, which in turn are a "live" documentation of the system (usually they use Gherkin to make it possible to write those in natural language), describing all of the application's features through multiple scenarios, which are in turn automated by a developer. Those, IMHO, could be also considered as both, functional tests and integration tests.

    Once you understand the key concept behind each of those, you get to be more flexible regarding the right or wrong. So, again IMHO, a functional test could also be considered an integration test. For the integration test, depending on the kind of integration it's exercising, it may not be considerate a functional test - but you generally have some requirements in mind when you are writing an integration test, so most of the time it can be also considerate as a functional test.

    Nicholas Pufal
    • 2,045
    • 18
    • 23