SpectiQL
SpectiQL is a JavaScript Graphical User Interface(GUI) for developers to easily create GraphQL tests. Our interactive interface simplifies the task of writing tests that checks GraphQL queries & mutations against a schema.
If you like our tool and would love to support our team, please donβt forget to star our Github repo above!
Overview
Features
- Interactive & user-friendly GUI spun up on endpoint /spectiql
- Create, Edit, or Delete GraphQL test suites within GUI
- Ability to generate ready-to-run test scripts with Jest
- Save & export (.js) test file into your project directory
- D3 Schema tree visualization
- Utilizes EasyGraphQL - an open source project containing tools that help simplify GraphQL (github)
Getting Started
Installation
- install SpectiQL
npm i [email protected]
- install Jest
npm i jest --save-dev
1. Import & configure your server by pasting in the following: Configuration
const { config, getSchema, testSchema } = require('spectiql'); const spect = config(); const getSchema = getSchema('#enter schema file path');
- Great! You've required the methods in. Now, we have to set up your endpoints to spin up SpectiQL on your server. You can do this by setting a get and post request to the endpoint β/spectiqlβ and calling spect & getSchema. Example:
app.get('/spectiql', spect); app.post('/spectiql', getSchema);
Generating and Exporting Tests
-
To generate tests, simply select a type of GraphQL query (queries, mutations, subscriptions) at the top sidebar. After selecting a test type, you can give your tests a name and description by populating the test suites and test description fields. This will be helpful to refer back to specific tests!
-
Select a specific test type (valid/invalid field, input, datatype) that you'd like to test for.
-
Enter your query that you'd like to test - the schema tree displays the possible inputs, fields, and types based on provided schema.
-
Click Generate Tests, and if the tests look good, Add to Test Suite! If you want to edit them later on, you can simply click "Edit Test" on the specific test suite card created.
-
After you've completed constructing all your test suites, click on the "Export" button on the upper right corner on the screen. The test file will be saved as "spectiql.test.js". Simply drag the test file into your project root directory, and run the script with jest!
Authors
Jonah Lin @linjonah
Justin Kwon @jkwonny
Kelly Dekitani @kairiD
Stanford Dai @dais002
License
This project is licensed under the MIT License - see the LICENSE file for details.