Skip to content

Instantly share code, notes, and snippets.

@marxxxx
marxxxx / gist:93bf4a0a75ec906752ff9b9496d7c1bc
Last active June 4, 2022 09:02
Anatomy of Integration Tests
The anatomy of the refactoring-resistent tests i was refering to above is basically this:
Arrange
- Setup dependencies by mostly using actual prod code, including actual instance of db, mocks/stubs only for external services i don't control
- Get system to a state required to execute the behavior i want to test by using public api of the system (e.g. when i register a user i need for the test, i execute the same code that would be executed when a user would register by using the actual software, i don't fake the state with stubs or take shortcuts by adding prepared data to db directly) i want the software to get to the desired state by running the actual production code
Act
- Execute operation i want to test
Assert