Integration Testing Flashcards
Test Database Approaches
- Shared Database.
2. Local Database.
Shared Database
All Developers share a remote test database on the network. #1 Oracle DB.
Local Database
Each developer has their own copy of the database on their computer. #1 MySQL. #2 PostgreSQL.
Shared Database Pros
- Easy Developer setup.
- 1 Setup for all developers.
- Production-like software and hardware.
- Can be managed by DBAs.
Shared Database Cons
- Unreliable.
- Brittle.
- No Isolation.
- Temptation to rely on existing data.
Local Database Pros
- Production-like software.
- Reliable.
- Isolation.
Local Database Cons
- Requires developer to act as DBA.
- RDBMS needs to be installed locally, requiring additional licenses.
- Hardware is not production-like.
- Production like data can be difficult
Inconsistent across machines
Embedded Database
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.
Embedded Database Pros
- Very reliable.
- Consistent across machines.
- Lightweight.
- Supports Continuous Integration.
Embedded Database Cons
- Software and hardware are not production-like.
- Can not use proprietary features of an RDBMS.
- Production-like data can be difficult.
Integration Testing
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.
Integration tests characteristics
- Use the same tools as unit tests (i.e. JUnit).
- Usually slower than unit tests.
- More complex to write and debug.
- Can have dependencies on outside resources like files or a database.
Integration tests should be:
- Repeatable.
- Independent.
- Obvious.
Repeatable Integration test
If the test passes/fails on the first execution, it should pass/fail on the second execution if no code has changed.
Independent Integration test
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.