Integration tests
Ideal vs Real on practice in iq
Schedule
- Some words about IQ backend
- Perfect story for me
- Real situation in IQ
- Proposal for discussion
Some words about IQ
IQ BACKEND

- Many requests to side services
- The most important client - frontend
- Some endpoints called by ems events
- Legacy code exists
- DI same as Angular
- Some requirements very complicated and nobody knows what right
IQ BACKEND
Some words about DI (and more next time)

- own DI decorators
- Request scope
- Global scope
- Async-await tokens
- Request tokens
- And more - some middlewares for work in node.js
IQ BACKEND
Some words about TS
- Everything in IQ typed
- Some interfaces are very bad and with spreaded fields
- Some side services hasn't appropriate interfaces
- I need one field for test, but interface has hundred fields

Perfect story from me
Consumer driver contract
Consumer
Producer
Request
Response
Tests
Tests
Contract
- Requirement from client (endpoint and response)
- Parameters for requirement (request params)
- Performance (artllery.io)
- Quality of code (lint)
Pact - interaction, BDD - scenario
EsLint, TsLint - Quality of code
Pact-defined

Essense of system

Contract
Client
Contract
Tests
Tests
Backend
Auto-generate
Client
Contract
Tests
Tests
Backend
Auto-generate
a = Bool to a = Number
Finally
- Auto-generate tests
- Same contract for clients and backend
- Microservices
- Hierarchy of contracts ( chain of contracts)
- What about environment?
- Tests run on fully running microservice with all dependencies isolated on docker network
- Database start from prepared snapshoot
- Test endpoint from start to end + performance
Very long process but with different levels
Real situation in iq
Environment

- Dev-ga-02
- Prepared study and other entities
- Some improvements for performance
What do we test
- Fake controller
- Real services
- Fake requests, not working validation


How do we test
- All process
- Function call fake controller requests

How do we test
- Imitate token
- Imitate Request
- Connection to Db, Redis

Why is it that complicated
- Get, set tokens
- Get, set configs
- Speed
- Some fake services
- What do you do with integration tests if SIR have broken down?)
- We have problems, but this works

It is perfect but in only one tiny thing
Copy of Микросервисы
By cloudkserg
Copy of Микросервисы
- 45