Aranya (Catalan for "spider") is a general-purpose JSON-crawling spider for the recursive validation of 'response' data structures against a GraphQL introspection SDL (schema definition language), itself also a JSON response.
Why? Because there's a general-purpose need for ensuring that responses are valid, fit for further consumption. It's defensive programming for a use case that appears whenever you request information and recieve a response in a JSON format (which also has an accompanying SDL).
Aranya will exhaustively walk any and all response objects, recursively validating each part of the response by:
-
automatically testing the
__typedef
against the current SDL introspection (reflection) to semantically verify the existence and contents of all the data struct members, and -
executing human-curated semantic tests which confirm relational requirements ("when this is present then those items must be...")
Aranya can be integrated into a continuous integration (CI) or continuous development (CD) build process; providing a scheduled, constant, significant regression test using the same live SDL as the apps being built.
-
Exhaustive exploration of live response objects using real, non-trivial queries (or lesser examinations made from human-compiled lists of "what's important" at the time of test-writing).
-
Having the spider be a first-class consumer of development's GraphQL efforts allows aranya to automatically - without any human involvement - remain in sync with changes and enhancements in the SDL.
-
Exhaustive and dynamically-updated coverage of all response elements without concern for order, format, or quantity.
Aranya consists of the following general-purpose modules:
- [done] The main spider mechanism to crawl arbitrary JSON trees (spider.rb)
- A tool to digest the current SDL into an actionable test routine
- Consuming the digest and dispatching testing through the crawl
- Adding human-curated type-specific contextually-appropriate tests
- Integrating into the CI pipeline