I have a simulation where i have a mix of scenarios, some of which are users logging into the system and some where an api is being hit using a certificate.
I would like to have a mix of both in my simulation, however, the gatling.conf file specifies a single keystore/truststore that gets loaded prior to the simulation being run.
This causes my standard auth scenarios to error out. Is there a way to specify the connection type on the session without using the global gatling.conf file and is there an example of how to do this? Is this done in the setup of the simulation, or within the scenario itself?
Ideally, I would potentially also like to authenticate with multiple certificates, one for each different scenario, is this possible? Here is the setup to my simulation file. First 3 are being fed usernames and passwords through a feeder and the last is a certificate user scenario.
class LoadSimulation extends Simulation {
def httpProtocol: HttpProtocolBuilder = http
.baseUrl(SimulationUtils.BASE_URL)
.headers(SimulationUtils.DEFAULT_HEADERS)
.inferHtmlResources(WhiteList(SimulationUtils.BASE_URL + "/docp/.*")) //automatically load injected javascript that comes from HTML
.disableCaching
def httpProtocolLocal: HttpProtocolBuilder = http
.baseUrl(SimulationUtils.BASE_URL_LOCAL)
.header("Content-Type", "application/json")
.disableCaching
.disableUrlEncoding
setUp(
/**
* 1. Login
* 2. Search for an invoice
* 3. Click on random invoice in the row
* 4. Repeat steps 2 and 3, 10 times
*/
BuyerInvoiceSearchScenario.ScenarioBuilder.inject(
heavisideUsers(50) during (60 seconds)
).protocols(httpProtocol),
/**
* 1. Login
* 2. Search for an PO
* 3. Click on random PO in the row
* 4. Repeat steps 2 and 3, 2 times
*/
BuyerPurchaseOrderSearchScenario.ScenarioBuilder.inject(
heavisideUsers(50) during (60 seconds)
).protocols(httpProtocol),
/**
* 1. Go to the welcome app.
* 2. Request invoices using access token
* 3. Request invoice history
* 4. Repeat steps 2 and 3, 10 times
*/
InvoiceWelcomeAppScenario.ScenarioBuilder.inject(
heavisideUsers(100) during (60 seconds)
).protocols(
httpProtocol
.header("x-p2p-client", "welcome")
)
)
/** 1. Hit api with cert user credentials to retrieve invoices */
CertUserScenario.ScenarioBuilder.inject(heavisideUsers(100) during (10 seconds)
).protocols(httpProtocolLocal)
}