Integration Testing Flashcards

1
Q

Test Database Approaches

A
  1. Shared Database.

2. Local Database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Shared Database

A
All Developers share a remote test database on the network.
#1 Oracle DB.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Local Database

A
Each developer has their own copy of the database on their computer.
#1 MySQL.
#2 PostgreSQL.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Shared Database Pros

A
  1. Easy Developer setup.
  2. 1 Setup for all developers.
  3. Production-like software and hardware.
  4. Can be managed by DBAs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Shared Database Cons

A
  1. Unreliable.
  2. Brittle.
  3. No Isolation.
  4. Temptation to rely on existing data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Local Database Pros

A
  1. Production-like software.
  2. Reliable.
  3. Isolation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Local Database Cons

A
  1. Requires developer to act as DBA.
  2. RDBMS needs to be installed locally, requiring additional licenses.
  3. Hardware is not production-like.
  4. Production like data can be difficult
    Inconsistent across machines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Embedded Database

A
An in-memory database server is started and managed by test code and run inside the application.
#1 SQLite.
#2 Firebird SQL.
#3 ScimoreDB.
#4 Oracle Berkley DB.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Embedded Database Pros

A
  1. Very reliable.
  2. Consistent across machines.
  3. Lightweight.
  4. Supports Continuous Integration.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Embedded Database Cons

A
  1. Software and hardware are not production-like.
  2. Can not use proprietary features of an RDBMS.
  3. Production-like data can be difficult.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Integration Testing

A

Is a broad category of tests that validate the integration between units of code or code and outside dependencies such as databases or network resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Integration tests characteristics

A
  1. Use the same tools as unit tests (i.e. JUnit).
  2. Usually slower than unit tests.
  3. More complex to write and debug.
  4. Can have dependencies on outside resources like files or a database.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Integration tests should be:

A
  1. Repeatable.
  2. Independent.
  3. Obvious.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Repeatable Integration test

A

If the test passes/fails on the first execution, it should pass/fail on the second execution if no code has changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Independent Integration test

A

A test should be able to be run on its own, independently of other tests, OR together with other tests, and have the same result either way.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Obvious Integration test

A

When a test fails, it should be as obvious as possible why it failed.

17
Q

Integration Tests should NEVER use

A

Existing data

18
Q

Integration Test Data Source

A

SingleConnectionDataSource - creates a direct connection without a connection pool, allowing steps to share the connection, and see changes being made by other steps.

19
Q

Integration Test Life Cycle

A

@BeforeClass - runs once before all tests. Creates the DataSource and enables Transaction Scope (autocommit=false)
@Before - runs before each test for common Arrange steps
@Test - the test
@After - runs after each test. Rollback transaction
@AfterClass - runs once after all tests complete. Destroy the DataSource.