Questions tagged [integration-tests]

Integration testing is the phase in software testing in which individual software modules are combined and tested as a group. No mocks or stubs are required; everything is tested as in production.

Integration testing is the phase in software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before system testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing.

No mocking or stubs are required; everything should be as in production.

273 questions
143
votes
7 answers

What is an integration test exactly?

My friends and I have been struggling to classify exactly what is an integration test. Now, on my way home, I just realised, that every time I try to give a real world example of an integration test, it turns out to be an acceptance test, ie.…
Martin Blore
  • 4,645
  • 5
  • 29
  • 35
143
votes
11 answers

Are (database) integration tests bad?

Some people maintain that integration tests are all kinds of bad and wrong - everything must be unit-tested, which means you have to mock dependencies; an option which, for various reasons, I'm not always fond of. I find that, in some cases, a…
mindplay.dk
  • 1,677
  • 2
  • 11
  • 13
120
votes
8 answers

How exactly should unit tests be written without mocking extensively?

As I understand, the point of unit tests is to test units of code in isolation. This means, that: They should not break by any unrelated code change elsewhere in the codebase. Only one unit test should break by a bug in the tested unit, as opposed…
Alex Lomia
  • 1,301
  • 2
  • 9
  • 9
105
votes
9 answers

What's the point of running unit tests on a CI server?

Why would you run unit tests on a CI server? Surely, by the time something gets committed to master, a developer has already run all the unit tests before and fixed any errors that might've occurred with their new code. Isn't that the point of unit…
74
votes
6 answers

Is there a point to unit tests that stub and mock everything public?

When doing unit tests the "proper" way, i.e. stubbing every public call and return preset values or mocks, I feel like I'm not actually testing anything. I'm literally looking at my code and creating examples based on the flow of logic through my…
enthrops
  • 843
  • 1
  • 7
  • 6
71
votes
5 answers

Do I need unit test if I already have integration test?

If I already have integration test for my program, and they all passed, then I have a good feel that it will work. Then what are the reasons to write/add unit tests? Since I already have to write integration tests anyway, I will like to only write…
Bryan Chen
  • 1,065
  • 1
  • 8
  • 13
69
votes
7 answers

Is it sufficient to use acceptance and integration tests instead of unit test?

Short introduction to this question. I have used now TDD and lately BDD for over one year now. I use techniques like mocking to make writing my tests more efficiently. Lately I have started a personal project to write a little money management…
Yggdrasil
  • 908
  • 1
  • 7
  • 10
64
votes
5 answers

Is the usage of random values in unit testing a good practice?

Having worked in complex solutions that had Unit Tests and Integration Test in the CI/CD pipeline, I recall having a tough time with tests that failed randomly (either due to random values being injected or because of the async nature of the process…
49
votes
8 answers

How do I really write tests without mocking/stubbing?

I have been using TDD when developing some of my side projects and have been loving it. The issue, however, is that stubbing classes for unit tests is a pain and makes you afraid of refactoring. I started researching and I see that there is a group…
kibe
  • 728
  • 1
  • 7
  • 11
41
votes
3 answers

Are integration tests meant to repeat all unit tests?

Let's say I have a function (written in Ruby, but should be understandable by everyone): def am_I_old_enough?(name = 'filip') person = Person::API.new(name) if person.male? return person.age > 21 else return person.age > 18 …
Filip Bartuzi
  • 565
  • 1
  • 5
  • 13
38
votes
3 answers

How do integration tests criticize design?

I'm having a read at J.B. Rainsberger's blog post on integrated tests and wonder in which way an integration test is more harsh with our design? We write more integrated tests, which are bigger and don’t criticize our design as harshly as…
Alex.U
  • 373
  • 4
  • 9
37
votes
2 answers

Does integration testing use mocks?

I am currently in a class for software testing where for our semester project, we have to perform multiple types of testing on it, such as unit testing and integration testing. For integration testing, the professor said to use mocks and mocking…
TheLegendOfCode
  • 489
  • 1
  • 4
  • 4
35
votes
3 answers

What is the point of repeatedly executing the same test?

I have recently learned about the not-well-known and not-widely-used annotation @RepeatedTest that, as the name implies, repeats the very same test n-times. Baeldung provides a short guide to this feature, however; I have found nowhere to explain…
35
votes
9 answers

Is it reasonable to not write unit tests because they tend to get commented out later or because integration tests are more valuable?

I was discussing unit/integration testing with a colleague, and he made an interesting case against writing unit tests. I'm a big unit test (JUnit primarily) proponent, but am interested to hear others' takes, as he made some interesting points. To…
Jeff Levine
  • 477
  • 4
  • 6
35
votes
3 answers

What does stubbing mean in programming?

I often hear the term "stub", "stub something out", "stubs", and so forth. What does stubbing mean in programming, and where does the word come from? In what contexts can it be used?
1
2 3
18 19