Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Gatling Performance Workshop

262 views

Published on

Gatling Performance Workshop

Published in: Software
  • Hello, is there any specific reason for choosing gattling over jmeter? If yes can you please tell me how to start with gattling as I am new to performance testing.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Gatling Performance Workshop

  1. 1. PERFORMANCE TESTING WITH GATLING Thoughtworks Bangalore
  2. 2. Overview What is covered? ● Brief about Gatling ● Pre-requisites ● Writing first test - hands on What is not covered? ● Performance load modelling ● Scala language itself ● Gradle - Build tool that we have used
  3. 3. What is Gatling? Performance testing framework developed using Scala with a focus on web applications ● Server side ● Written in Scala
  4. 4. Why Gatling?.. 1. Open-source tool 2. Simple 3. High performance 4. Good reports 5. Easy integration with CI
  5. 5. Pre-requisites 1. Java 2. Scala 3. Any build tool (optional) - We will be using Gradle 4. Any IDE like Eclipse or IntelliJ
  6. 6. Machine set up https://github.com/swetashegde/gatling-for-beginners has detailed steps for Mac and Windows set up with a sample project.
  7. 7. Let’s begin..
  8. 8. Run a sample server to test To run a local server on machines: mb start --configfile=mb-config.ejs Use postman to check the endpoints.
  9. 9. Create a Gradle Project
  10. 10. Create a Gradle Project Edit your build.gradle file: ● Add dependencies ● Add task gatling
  11. 11. Create the Project Skeleton Create the following structure for your project:
  12. 12. Some Keywords val - constant value object - class with a single instance exec - execution step http - declares an http request scenario- declares a scenario Find more : http://gatling.io/#/cheat-sheet/2.2.2
  13. 13. Setting up the protocol This is where we set up: ● Base domain for our tests Example: http://www.example.com/search ● Request headers that the target APIs accept Example: Content-Type: application/json
  14. 14. Writing a simple query A query can be constructed for each endpoint under test. Writing this way would make the tests simpler and readable Query consists of: ● Query name and request name ● Endpoint with request method ● Any specific params ● Expected response Syntax: val <name> = http(“<query_name>”) .<request-method>(“/endpoint”) .check(<expected_status>)
  15. 15. Scenarios Scenarios are essentially user flows that we would want to simulate. Usual way to construct a simple scenario is: ● Add queries in a sequential manner to create a user journey ● Add waits in between if required Syntax: val name = scenario(<scenario_name>) .exec(query1) .pause() .exec(query2) ...
  16. 16. Simulations Simulations are where we define the amount of load we want to inject into our servers Things required to construct a simulation: ● Scenario ● Protocol ● Assertions Syntax: setUp(<scenario>.inject(<injection_step>)) .protocols(<protocol_name>) .assertions(<condition>)
  17. 17. Get..set..run!! gradle clean gatling
  18. 18. REPORTS
  19. 19. References & credits ● http://gatling.io/ ● https://github.com/lkishalmi/gradle-gatling-plugin ● http://www.mbtest.org/ ● https://www.thoughtworks.com/insights/blog/gatling-take-your-performance-tests-next-level ● http://gatling.io/#/cheat-sheet/2.1.7
  20. 20. THANK YOU

×