Questions tagged [integration-testing]

A form of software testing where individual software modules (or components) are combined and tested as a group. Integration testing happens after unit testing, and before system testing.

Integration testing is a form of software testing where individual software modules (or components) are combined and tested as a group. Integration testing happens after unit testing, and before system testing.

In an integration test, all input modules are modules that have already been unit tested. These modules are grouped in larger aggregates and integration tests are applied to those aggregates. After a successful integration test, the integrated system is ready for system testing.

6972 questions
87
votes
3 answers

Difference between MockMvc and RestTemplate in integration tests

Both MockMvc and RestTemplate are used for integration tests with Spring and JUnit. Question is: what's the difference between them and when we should choose one over another? Here are just examples of both options: //MockMVC…
Denis C de Azevedo
  • 6,276
  • 2
  • 32
  • 49
86
votes
10 answers

How to test a confirm dialog with Cucumber?

I am using Ruby on Rails with Cucumber and Capybara. How would I go about testing a simple confirm command ("Are you sure?")? Also, where could I find further documentation on this issue?
Yuval Karmi
  • 26,277
  • 39
  • 124
  • 175
85
votes
11 answers

Before and After Suite execution hook in jUnit 4.x

I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm looking to port back to jUnit. What hooks are…
sblundy
  • 60,628
  • 22
  • 121
  • 123
83
votes
8 answers

How to make Capybara check for visibility after some JS has run?

After loading a page I have code that runs and hides and shows various items based on data returned by an xhr. My integration test looks something like this: it "should not show the blah" do page.find('#blah').visible?.should be_true end When…
Kevin Davis
  • 2,698
  • 1
  • 22
  • 27
82
votes
11 answers

Is there a standard domain for testing "throwaway" email?

I've noticed that the domain contoso.com is often used in documentation when a sample is needed. I always figured this was a dummy domain, used like the telephone prefix "555" to route spam into some kind of telecommunicative void (although…
harpo
  • 41,820
  • 13
  • 96
  • 131
81
votes
14 answers

How do you test an Android application across multiple Activities?

We are building a complex Android application consisting of many screens and workflows spread across many Activities. Our workflows are similar to what you might see on a Bank's ATM machine, for example, there is an Activity to login in that…
SingleShot
  • 18,821
  • 13
  • 71
  • 101
77
votes
11 answers

How to write unit tests for database calls

I'm near the beginning of a new project and (gasp!) for the first time ever I'm trying to include unit tests in a project of mine. I'm having trouble devising some of the unit tests themselves. I have a few methods which have been easy enough to…
74
votes
14 answers

Test Container test cases are failing due to "Could not find a valid Docker environment"

I am very new to using test containers. My test is failing with below exception. Running com.mastercard.example.testcontainers.testcontainersexampple.DemoControllerTest 2020-04-08 14:27:08.441 INFO --- [ main]…
Ketan
  • 2,612
  • 5
  • 31
  • 44
73
votes
3 answers

How to keep Unit tests and Integrations tests separate in pytest

According to Wikipedia and various articles it is best practice to divide tests into Unit tests (run first) and Integration tests (run second), where Unit tests are typically very fast and should be run with every build in a CI environment, however…
Tom Malkin
  • 2,134
  • 2
  • 19
  • 35
72
votes
13 answers

How to test file inputs with Cypress?

How can I write an e2e test of flow that requires interaction with the file Input DOM element? If it's a text input I can interact with it (check value, set value) etc as its a DOM component. But If I have a File Input element, I am guessing that…
sidoshi
  • 2,040
  • 2
  • 15
  • 30
70
votes
17 answers

How to configure JPA for testing in Maven

Is there a way to set up a second persistence.xml file in a Maven project such that it is used for testing instead of the normal one that is used for deployment? I tried putting a persistence.xml into src/test/resources/META-INF, which gets copied…
Peter Becker
  • 8,795
  • 7
  • 41
  • 64
70
votes
7 answers

How can I skip tests in maven install goal, while running them in maven test goal?

I have a multi-module maven project with both integration and unit tests in the same folder (src/test/java). Integration tests are marked with @Category(IntegrationTest.class). I want to end up with the following setup: If I run mvn install, I want…
68
votes
4 answers

Best practices for integration tests with Maven?

I have a project which I am building with Maven which uses Hibernate (and Spring) to retrieve data from a database, etc. My "tests" for the DAOs in my project extend Spring's AbstractTransactionalDataSourceSpringContextTests so that a DataSource can…
matt b
  • 138,234
  • 66
  • 282
  • 345
67
votes
13 answers

how to test react-select with react-testing-library

App.js import React, { Component } from "react"; import Select from "react-select"; const SELECT_OPTIONS = ["FOO", "BAR"].map(e => { return { value: e, label: e }; }); class App extends Component { state = { selected:…
65
votes
8 answers

Integration Testing POSTing an entire object to Spring MVC controller

Is there a way to pass an entire form object on mock request when integration testing a spring mvc web app? All I can find is to pass each field separately as a param like…
Pete
  • 10,720
  • 25
  • 94
  • 139