88
99[ ![ Coverage Status] ( https://coveralls.io/repos/github/EasyGraphQL/easygraphql-load-tester/badge.svg?branch=master )] ( https://coveralls.io/github/EasyGraphQL/easygraphql-load-tester?branch=master ) [ ![ Greenkeeper badge] ( https://badges.greenkeeper.io/EasyGraphQL/easygraphql-load-tester.svg )] ( https://greenkeeper.io/ )
1010
11- easygraphql-load-tester is a node library created to make load
11+ easygraphql-load-tester is a node library created to make load
1212testing on GraphQL based on the schema; it'll create a bunch of queries, that are going to be the ones used to test your server.
1313
1414## Installation
@@ -31,14 +31,14 @@ $ npm install easygraphql-load-tester --save
3131+ Read the schema.
3232+ Initialize the tester, and pass the schema as the first argument.
3333 + If there are multiples schemas pass an array with the schemas an argument.
34- + ** Note** : In order to use multiples schema files, the queries and mutations must be extended. +
34+ + ** Note** : In order to use multiples schema files, the queries and mutations must be extended. +
3535+ The second argument is the arguments on the queries, ** only** if there are some of them.
3636 + ** Note** : If an argument is an array it should be passed as an ` string ` , e.g: ` '["name", "name 2"]' `
3737
3838
3939### One schema file
4040``` js
41- ' use strict'
41+ ' use strict'
4242
4343const EasyGraphQLLoadTester = require (' easygraphql-load-tester' )
4444const fs = require (' fs' )
@@ -51,7 +51,7 @@ const loadTester = new EasyGraphQLLoadTester(userSchema)
5151
5252### Multiples schemas files
5353``` js
54- ' use strict'
54+ ' use strict'
5555
5656const EasyGraphQLLoadTester = require (' easygraphql-load-tester' )
5757const fs = require (' fs' )
@@ -89,7 +89,7 @@ const loadTester = new EasyGraphQLLoadTester(schema)
8989
9090## Artillery
9191
92- To use with [ artillery] ( https://artillery.io ) , you must have it installed in your project,
92+ To use with [ artillery] ( https://artillery.io ) , you must have it installed in your project,
9393in case you don't have it just run:
9494
9595``` shell
@@ -100,7 +100,7 @@ $ npm install artillery --saved-dev
100100You should configure your ` index.js ` file:
101101
102102``` js
103- ' use strict'
103+ ' use strict'
104104
105105const EasyGraphQLLoadTester = require (' easygraphql-load-tester' )
106106const fs = require (' fs' )
@@ -226,18 +226,18 @@ config:
226226 - duration : 5
227227 arrivalRate : 1
228228 processor : " ./index.js"
229- scenarios :
230- - name : " GraphQL Query load test"
231- flow :
232- - function : " testCases"
233- - loop :
234- - post :
235- url : " /"
236- json :
237- query : " {{ $loopElement.query }}"
238- - log : " ----------------------------------"
239- - log : " Sent a request to the Query: {{ $loopElement.name }}"
240- over : cases
229+ scenarios :
230+ - name : " GraphQL Query load test"
231+ flow :
232+ - function : " testCases"
233+ - loop :
234+ - post :
235+ url : " /"
236+ json :
237+ query : " {{ $loopElement.query }}"
238+ - log : " ----------------------------------"
239+ - log : " Sent a request to the Query: {{ $loopElement.name }}"
240+ over : cases
241241` ` `
242242*In this case the server is running on http://localhost:5000/*
243243
@@ -281,14 +281,14 @@ The result is going to be something like this if you apply the basic configurati
281281
282282# # k6
283283
284- To use with [k6](https://docs.k6.io/docs/), you must have it installed on your computer,
284+ To use with [k6](https://docs.k6.io/docs/), you must have it installed on your computer,
285285in case you don't have it, visit the [installation guide](https://docs.k6.io/docs/installation)
286286
287287# ## index.js
288288You should configure your `index.js` file :
289289
290290` ` ` js
291- 'use strict'
291+ 'use strict'
292292
293293const EasyGraphQLLoadTester = require('easygraphql-load-tester')
294294const fs = require('fs')
@@ -456,13 +456,13 @@ can learn from your story.
456456
457457# # Importance of using dataloaders
458458
459- Some time ago I was working on a GraphQL project that includes activities and
460- each activity can have some comments with the info of the user that created the comment.
459+ Some time ago I was working on a GraphQL project that includes activities and
460+ each activity can have some comments with the info of the user that created the comment.
461461The first thing that you might think is that it is a problem of query n + 1 , and yes; it is!
462462
463- I decided to implement dataloaders but for some reason, there was an error on the
464- implementation, so it wasn't caching the query and the result was a lot of
465- request to the database. After finding that issue I implemented it on the right
463+ I decided to implement dataloaders but for some reason, there was an error on the
464+ implementation, so it wasn't caching the query and the result was a lot of
465+ request to the database. After finding that issue I implemented it on the right
466466way reducing the queries to the database from 46 to 6.
467467
468468# ## Results without dataloaders
0 commit comments