-
Notifications
You must be signed in to change notification settings - Fork 280
Future Dredd proposal #1186
Comments
Thanks once more for sharing these insights. Giving my feedback below. Hooks
What implications do you see if we would allow instead to return the next transaction from a hook? Hooks APII completely support Hooks API improvements you've mentioned. Here's how the current API looks like: const hooks = require('hooks');
hooks.before('Articles > Publish an article', (transaction) => {
transaction.request.headers.Authorization = 'Basic: YWxhZGRpbjpvcGVuc2VzYW1l';
}); Get rid of a hacky
|
JS Hooks
A few very significant implications - all current Dredd users would need to rewrite their existing hook files, and perhaps all hooks handlers for other languages should do a similar change to be aligned with the interface change. Rolling out such change is a delicate thing which could significantly harm adoption of Dredd by its current users. Streamlined interface? Yes. But for me the price is too high and benefit too low. I think it would make more sense to:
I think having
This is already supported by PHP hooks and there is an issue for that: #248 However, in long-term, I don't think using anything like "path" to address HTTP transactions is a good idea. After many design sessions and research, I'd propose the transaction names to become independent on structure of the API description document and rather becoming a "query language" for the list of transactions (e.g. 'gimme all transactions with HTTP 200 response' or 'all JSON body requests') possibly addressing more than one (which is a generalization of the wildcard idea). Syntax of such transaction names is TBD, but I think something has been written down as a proposal internally in Apiary whitepapers. 👉 Check out existing flaws of the JS hooks and their suggested solutions. Other
I think it means re-thinking the test report page from Apiary and re-implementing it from scratch in React components as part of the Dredd repository, i.e. open sourced. Then re-using these components in Apiary SaaS.
That sounds like implementation detail at this stage. If Dredd becomes a monorepo, it doesn't matter much if it lives in another package (directory). Tests
We discussed this in person pretty much, but I'll repeat my thoughts here. I'm not a fan of rewriting tests, it's dangerous and it doesn't bring any/much user value. However, the test suite as it is now is not sustainable. I believe following approach could work:
Diagram (flow)
That's kind of TBD, that's why the arrows are confusing and dotted. Now I tend to think it would be cleaner architecture if all input traffic went through the Fury toolchain and Dredd could consume it as API Elements, no matter what was it originally:
Dredd needs four things to validate a transaction: expected request, actual request, expected response, actual response. The only difference between the API description formats and the "recorded traffic" formats will be in which elements of the 4-tuple they provide. If some elements are missing, Dredd will need to somehow acquire them before it can perform the validation:
In this case, Dredd needs to infer an actual request and to perform the request in order to acquire an actual response. Then it can validate.
In this case, sharp reader will notice that the tuples zip together. Dredd doesn't need to infer actual requests and it doesn't need to do any HTTP communication to acquire actual responses. It only needs to pair the actual traffic to the corresponding expectations and continue with validation. (The Dredd run in this case would be super-fast as apart from reading & parsing the source files there's no IO.) It will still run some hooks though (beforeValidation, beforeEachValidation, ...). The architecture should be ready for this. That means Dredd needs to know what kind of source it is parsing (API description with expectations or actual traffic) and then combine what's available and/or infer what's missing (compile & perform HTTP request). Sounds like we'll need a lot of decoupling :) |
@artem-zakharchenko @honzajavorek @abtris Do you plan to implement the future any soon ? Or should we (users) consider this tool as "not maintained anymore" ? |
@mathieulaude Nobody from the original team works on Dredd anymore. AFAIK there's no dedicated team as of now, thus no future. @kuba-kubula at least still works in the company behind Dredd, so might have some info. But he might not be legally or process-wise allowed to make public announcements. |
Dredd reads the API description document, executes HTTP requests it finds, and validates the HTTP responses it receives.
I think Dredd's architecture should get more modular, decoupled. This is my idea on how it should look like:
Direction
dredd server
for testing server,dredd client
for testing clients (aka client-testing mock server: see this),dredd traffic
for testing arbitrary previously recorded trafficSupport
(dredd api) OR (dredd openapi) OR (dredd oas)
Architecture
dredd-transactions/parse
), the input interface for the Dredd core is API Elementsdredd-transactions/compile
).har
Gardening
The text was updated successfully, but these errors were encountered: