Comments (5)
Internal successful change
: The coupling argument is a good one. like if something changes the dev needs to change 2 parts in the tests (DAL + API requests) and not only one. API.
I think for now we can stick with API-only arrange (as much as possible) and re-think this in the future if needed.
I'm closing the issue, feel free to continue the discussion/reopen.
from nodejs-integration-tests-best-practices.
@mikicho Great point, exactly the kind of discussion that will push us perfect the component tests setup. There are no easy wins here, yet another trade-off. Does this table lack any considerations:
Through API | DB direct | |
---|---|---|
Failure in DB model (e.g. bug in DAL) | π€ππΌNot so easy to find the root cause: - Direct and indirect tests will fail (add & get). One should understand that OR Add OR Get has an issue - Logs should display error, we anyway need to assume that a developer can extract the exception easily from logs |
ππΌJust a bit easier to find the root cause: - Direct and indirect tests will fail (add & get). One should understand that OR Add OR Get has an issue - Logs should display error, we anyway need to assume that a developer can extract the exception easily from logs. Logs might be a bit clearer here |
Internal successful change in DB model (not bug, just change) | ππΌ Positive-positive, all pass, no issue | π’ False-positive (failure due to coupling to internals) |
Can run in remote mode (API deployed in another network) | ππΌ Yes | π’ No |
from nodejs-integration-tests-best-practices.
p.s. A valid test name will imply the failure reason:
test('**When adding a new user**, Then is should be retrievable')
from nodejs-integration-tests-best-practices.
About your nice chart.
Failure in DB model
(DAL) is pretty rare, at least relative to application failure. this layer changes the least.
Internal successful change in DB model
: you can say the same for API change. a lot of time schema changes are correlated to API changes and vice versa.
Can run in remote mode
: do you mean real calls for 3rd party services?
from nodejs-integration-tests-best-practices.
Failure in DB model - Means bug in your DAL. Your bug. This so common of course. For example, it means things like you added a new mandatory column but some route in your code doesn't provide that new field. Would you really say that changes in the data-access layer + DB are rare?
Internal successful change - Yes, it can change too, but then your tests are coupled to one layer and not to a few. Also, API changes sometimes are documented with OpenAPI and there are tests that show when you are deviating from the Swagger spec (we will show this hopefully)
Remote mode - When you want to run the same tests against your remote staging or production. Not 3rd party rather your Microservice which lives out of of the tests process
Is it clear now? What would you choose then? I like how you question our beliefs, keep being skeptical, this is our way to ENSURE we're suggesting the right things:)
from nodejs-integration-tests-best-practices.
Related Issues (20)
- Make TOC and recipe list (homepage) clickable
- Write last 3 best practices
- In Collab section - Write about yourself
- Create contributors table
- There are 2 api.js
- Create my-first-pr issues HOT 2
- MQ best practices HOT 2
- Create stale bot
- Create contributors bot
- Add more mySQL optimization flags
- Close sequalize connection in stopWebServer HOT 1
- Node Best
- Why mark `async` in the callback of `beforeAll`? HOT 1
- Nock with remote swagger HOT 1
- Lazy watch plugin
- VSCode snippets for integration tests
- DB cleanup recepie
- Create Fastify example HOT 1
- Put code examples
- put collaborators section HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodejs-integration-tests-best-practices.