1 of 22

Load testing

2 of 22

Web

Customers

GitHub (Static deployment, CI/CD)

Dev (QA)

AWS (Cloud deployment)

Testing

Linting

Coverage

Grafana (Observability, load & synthetic testing)

CDN

Scalable�compute

Scalable�db

Pages

Jest

Playwright

Penetration testing

Christlike

introspection

Curiosity

report

Metrics

Logging

Load testing

Actions

Chaos testing

TDD

3 of 22

Load testing

4 of 22

Gaining confidence your app

will stand up under pressure

5 of 22

Concurrent�customers

Latency

6 of 22

Concurrent�customers

Latency

7 of 22

Concurrent�customers

Latency

8 of 22

Web

AWS

CDN

Scalable�compute

Scalable�db

Load�Simulated customers

Customers

9 of 22

Type

Purpose

Load

Expected load

Soak

Expected load over an extended time period

Smoke

Low load

Spike

Sudden increase in load

Stress

Higher than expected load

10 of 22

Load testing is also

end to end testing (e2e)

11 of 22

K6

12 of 22

13 of 22

14 of 22

  • Build tests using Chrome
  • Modify JavaScript to refine tests
  • Create load:� #user, #locations, duration

15 of 22

16 of 22

import { sleep, check, group, fail } from 'k6'

res = http.put('https://pizza-service.cs329.click/api/auth', '{"email":"d@jwt.com","password":"a"}', {

headers: {

'content-type': 'application/json',

origin: 'https://pizza.cs329.click',

},

});

if (!check(res, { '200': response => res.status.toString() === '200' })) {� console.log(response.body);

fail('Login was *not* 200');

}

17 of 22

Create a load test

18 of 22

🍕Deliverable ⓾�Load testing: JWT Pizza Service

19 of 22

  1. Using a HAR file, build a test that:
    1. Logs in a user
    2. Navigates the menu to create a pizza order
    3. Buys the pizza
    4. Validates that the pizza JWT is valid
  2. Convert to a script
  3. Modify script to check results
  4. Modify script to pass JWT token

20 of 22

21 of 22

Assignment

  1. D10: Load testing
  2. commit to� jwt-pizzaloadTests/loginAndOrder.js
  3. submit image to Canvas

22 of 22

Get busy!