Gatling: how to set up and teardown script

I have a Gatling test that should do the following:

  • create user once
  • Retrieves user data according to a specific load model. Actual load testing.
  • delete user after completion

Question: How to imitate this with Gatling? If I make calls like:

val scn = scenario("Test scenario").exec(_create-user_).exec(_retrive-user_).exec(_delete-user_) setUp(scn).protocols(httpConf)) 

then creating and deleting the user will be part of the test.

+5
source share
1 answer

You can use the hooks before and after to create and delete a user.

 class RetrieveUserSimulation extends Simulation { before { // create user } setUp(scn).protocols(httpConf) after { // delete user } } 

You will have to manually create and delete HTTP requests. before and after take => Unit thunks, not Scenario s.

+5
source

Source: https://habr.com/ru/post/1245482/


All Articles