Closed astavria4 closed 3 years ago
hi @astavria4 👋 there's a couple of ways: you can generate mission ids on the fly, or load them from a CSV file.
To generate them on the fly, use a beforeRequest
hook:
https://artillery.io/docs/guides/guides/http-reference.html#Writing-custom-logic-in-Javascript
There's an example here you can adapt: https://github.com/artilleryio/artillery-examples/tree/main/http-set-custom-header
And to use a CSV file:
https://artillery.io/docs/guides/guides/test-script-reference.html#Payload-Files
And here's an example for using CSVs:
https://github.com/artilleryio/artillery-examples/tree/main/using-data-from-csv
I am using EasyGraphQL load tester in conjunction with Artillery to load test my graphql server. Im in the POC stage so I am going against the space x open source graphql server.
this is my index.js file:
'use strict'
const EasyGraphQLLoadTester = require('easygraphql-load-tester') var fs = require('fs') var path = require('path') var schema = fs.readFileSync(path.join(__dirname, 'test', 'missionSchema.graphql'), 'utf8')
const args = { mission: { id: '9D1B7E0' }
}
var loadTester = new EasyGraphQLLoadTester(schema, args)
const options = { selectedQueries: ['mission'], } var testCases = loadTester.artillery(options)
module.exports = { testCases }
This is my config file:
config: target: "http://localhost:8080/v1/graphql" phases:
Is it possible to set up Artillery to have each virtual user created to use a different misionId that is from a list of missionIds?
For example, I have this as my custom arg:
const args = { mission: { id: '9D1B7E0' }
}
Its passing in a hardcoded value as the id and each virtual user created uses this id. If I were to add another mission query to the args with an id of lets say 4. When running the tests, only 4 will be passed for each virtual user. Not 9D1B7E0 and 4.