Coder Social home page Coder Social logo

Comments (5)

mikicho avatar mikicho commented on May 20, 2024 1

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.

goldbergyoni avatar goldbergyoni commented on May 20, 2024

@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.

goldbergyoni avatar goldbergyoni commented on May 20, 2024

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.

mikicho avatar mikicho commented on May 20, 2024

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.

goldbergyoni avatar goldbergyoni commented on May 20, 2024

@mikicho

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.