/compatibility-unit-tests

Golang CLI library for validating compatibility of any GraphQL implementation against the GraphQL reference implementation(graphql-js).

Primary LanguageGoMIT LicenseMIT

Compatibility Unit Tests

Golang CLI library for validating compatibility of any GraphQL implementation against the GraphQL reference implementation: graphql-js.

Current implementation supports the following GraphQL implementations:

Contribute Back

Friendly reminder links are available in case you would like to contribute back into our commitment with Go and open-source.

Author PayPal Link
Chris Ramón https://www.paypal.com/donate/?hosted_button_id=WHUQQYEMTRQBJ

Quick Start

Running the library:

$ ./bin/start.sh

Screenshot from 2025-03-04 14-00-43

Validation Compatibility

The library validates compatibility by checking the end results of the unit tests from the choosen graphql implementation against the graphql-js implementation, the following checks are done:

The strategy works in the following steps:

1- Pulls the tests names of the JavaScript implementation, Eg:

describe('Execute: Handles execution with a complex schema', () => {
  it('executes using a schema', () => {
    // ...
  }
}

The name is converted to Go test name in the following syntax:

ExecuteHandlesExecutionWithAComplexSchema_ExecutesUsingASchema

Implementation Details

1- extractor-js: Pulls the tests names from the JavaScript GraphQL reference implementation.

2- extractor-js: Formats and saves the tests names into a file named: unit-tests.txt.

3- compatibility-unit-tests/extractor: Pulls the tests names from a GraphQL implementation, eg. Golang.

4- compatibility-unit-tests/validator: Compares the tests names from the JavaScript GraphQL reference implementation using unit-tests.txt against the GraphQL implementation, eg. Golang.

Further Work

There are multiple GraphQL implementations in different languages such in Golang:

Current work covers compatibility validation in terms of checking the tests names of the GraphQL reference implementation against the choosen implementation.

This could be extended into including the body and result of each test and improving the comparison and making a robust and deeper checks.