# [[ExpoQA talk - how to be a gish]] - API testing, browser automation, and chaos engineering in one script ## Details Duration:: 45 minutes - [The talk on ExpoQA site](https://expoqa.com/en-sessions.html#van_der_Hoeven) - [slides.nicolevanderhoeven.com](https://slides.nicolevanderhoeven.com/2022-how-to-be-a-gish/#/) - [Video](https://youtu.be/aq0XSNcXDb0): <iframe width="560" height="315" src="https://www.youtube.com/embed/aq0XSNcXDb0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> # How to be a Gish: API, browser, and chaos in one script ## Introduction How does a tester thrive in a world that has shifted left, right, and everywhere in between? The industry has moved beyond monoliths to microservices, beyond virtual servers to Kubernetes pods, beyond monitoring to observability. How do we make sure our testing practices evolve as well? The answer lies in becoming a gish. ## Content During this talk, Nicole van der Hoeven will talk about how to take a leaf from the world of tabletop roleplaying games by becoming a gish: a character that is skilled in a variety of disciplines. She will show you a practical example of how you can run end-to-end browser automation tests, an API load test, and a chaos experiment-- all in one script, using one programming language, in one tool. For free. ## Outcomes After attending this talk, you will: - Understand the benefits of a tester that cross-skills in other areas like development and Site Reliability Engineering - Know how to write load testing scripts quickly in an open-source tool called k6 - Be able to use k6's extension ecosystem to mix and match the types of tests you can run for your use case - Appreciate how generalists can thrive in a specialized world ## Target Audience Testers, developers, SREs, and other generalists. ## Related - [[Polymath]] - [[Range]] - ## Structure In roleplaying games like Dungeons & Dragons, you can choose a class for your character. A class is something like a profession, but it also describes the skills that you have. - Fighter: martial weapons - Wizard: magic So you might think that the most logical thing, when playing a character and choosing abilities as you level up, would be to lean into what you're already good at. If you're a fighter, choose abilities that enhance weapon attack and damage. If you're a spellcaster, choose those that increase the damage of your spells. And that works... for the lower levels. When you climb into higher tiers of play, (D&D goes up to level 20), this strategy quickly starts to show its cracks. Why? - Fighters can be controlled - Spellcasters are squishy So what do we do? ### In an environment of uncertainty, the generalist trumps the specialist. In D&D, a gish is a character that is skilled at both physical and magical combat. A gish might not be the best at either, but it's pretty good at both. How is this relevant to testing? - Testing is a multidisciplinary practice. - Hard skills + soft skills are equally prized in a tester - Tech moves quickly, but testers must move faster. - Breadth, not depth - Philosophical changes in code and infrastructure can drastically affect the way we test - Many things can go wrong in an application. Software is deployed into an environment of uncertainty. - Attacking problems from different perspectives Take the word "performance". What does it actually mean? - Low response times? What about: - Having something to interact with, even if the page isn't loaded? - Information being saved for later processing even when an outage occurs? These are things that a fighter tester or magic user tester might not prepare for. A gish tester looks at these questions and more, regardless of their job description, and looks to incorporate different forms of testing in their test scripts. I'm going to show you how to do: - API load testing - browser automation - chaos testing in one script, using a free and open-source tool. #### k6 Why k6? - JavaScript, but Go underneath - performant - works well with others - (steal stuff from my [[Intro to load testing with Grafana and k6]] talk) #### **Level 1: The Browser Automation Maneuver** In this first sentence, tell the reader why it's so important. Next, give them a few quick examples. Either tell them how to do this in more detail, or maybe tell them a quick story of how someone else put this into action and what reward they unlocked as a result. #### **Level 2: The API Load Testing Cantrip** Now, in this first sentence, tell the reader where so many go wrong when it comes to this second step. Next, give a few quick examples. Explain why, in more detail, this is a mistake so many people make. And then, tell the reader what they need to do to avoid it. #### **Level 3: The Chaos Engineering Feat** In this first sentence, motivate the reader by telling them of the light at the end of the tunnel. Explain what this step, and the others before it, all ladder up to. Be specific, and give the reader hope as to what they can expect as a result of taking these steps. ### Statblocks ```statblock name: Wolverine image: [[wolverine.png]] size: Medium type: humanoid alignment: chaotic neutral ac: 17 hp: 92 hit_dice: 9d12+27 speed: 40 ft. stats: [18, 14, 16, 8, 12, 10] cr: 20 saves: - Str: 9 - Dex: 3 - Con: 8 - Int: 3 - Wis: 2 - Cha: 1 skillsaves: - Browser automation: 10 - Front-end perf: 10 - End-to-end testing: 10 damage_vulnerabilities: senses: passive Performance 15 languages: JavaScript, HTML, CSS traits: - [DevTools expert, Wolverine can tell you the selector of a page element in 3 seconds flat.] actions: - [Get TTFB, Wolverine executes a browser test. Melee Weapon Attack: +6 to hit, reach 5 ft., one target. Hit: 11 (1d12+5) performance damage to the application server.] ``` ```statblock name: Storm image: [[storm-gish.png]] columns: 2 columnHeight: 200 forceColumns: true size: Medium type: humanoid alignment: lawful good ac: 14 hp: 57 hit_dice: 9d8+9 speed: 30 ft. stats: [10, 14, 13, 12, 15, 20] cr: 15 saves: - Str: 1 - Dex: 7 - Con: 2 - Int: 2 - Wis: 3 - Cha: 10 skillsaves: - Browser automation: 7 - Front-end perf: 7 - End-to-end testing: 8 - Back-end perf: 9 - Database tuning: 6 - Chaos testing: 7 - Development: 7 senses: passive Performance 18, passive Investigation 15 languages: JavaScript, HTML, CSS, Go, Python, Ruby on Rails traits: - [Not on my watch, Storm automatically reports defects within 30 ft. of her without taking an action.] actions: - [Run browser test, Storm writes a short browser automation test and commits it to the main app code repository. Ranged Weapon Attack: +6 to hit, reach 30 ft., one target. Hit: 7 (1d6 + 4) automation damage.] - [Test microservices, Storm simulates peak load against multiple system components and records the results. All microservices within 30 ft. must make a DC 17 Constitution saving throw or take 10 (2d6+4) load damage.] - [Unleash the chaos, Storm channels the destructive power of weather and systematically terminates pods in the Kubernetes cluster to build confidence in the system. Storm automatically does 12 (1d10)+6 chaos damage to a random enemy target.] ``` ## Presentation ## [[How to be a Gish]] ## Feedback ![[louise-gibbs-sketchnotes-how-to-be-a-gish.png]]