Latest / BrowserStack Talks / API Testing with Kristin Jackvony, Smartsense by Digi
Transcript
- speaker-0: think about API testing is it requires a mindset change where you're thinking not about what the user is doing, you're thinking about what's happening behind the scenes. I would recommend when you're writing automation that and you want to get into API automation, just focus on the API automation first. When you're starting to work with that test, Don't just say, here's the test, and so I need to do all the steps that were in this test. Ask yourself, why am I running this test? you speaker-1: Welcome to Browsers.Talk, conversations that turn testing points into playbooks. I'm your host David, and today we're joined by someone who literally wrote the book on being a complete software tester. as a principal QA engineer, has done lots of writing, but I'm going to let Kristen introduce herself. Go for it, Kristen. speaker-0: Hello, I'm Kristen Jackfoney. I've been in software testing for almost 18 years now. I'm the author of three books, The Complete Software Tester, The Professional Software Tester, and Logical Fallacies for Testers. And I've got a LinkedIn learning course all about Postman. And I also have a completely free online YouTube course about getting started with software test automation. So I'm thrilled to be here and thanks for having me. speaker-1: Well, thank you for joining us. ⁓ One of the things that like when I was doing my research is that like you've often said that API tests are faster and more reliable than UI tests. I can agree with that. Having worked on UI frameworks, definitely I agree with that. ⁓ But unfortunately, I also noticed that a lot of people are intimidated. by API testing. So I'm hoping the next set of questions can help demystify it. ⁓ For kind of a manual tester who's used to clicking through a UI or exploring the user interface, and user interface can mean multiple things here, it doesn't mean to be graphical, ⁓ why have you found that people find APIs so daunting in the first place? speaker-0: Well, I think it's because most software testers get their start interacting with the application just exactly the way that a user would. So they're using the AI. They're using what is exactly in front of them. They're thinking like the user, and they're saying, well, the user is going to click here. The user is going to fill out this form. But to think about API testing requires a mindset change, where you're thinking, not about what the user is doing, you're thinking about what's happening behind the scenes. And so that can be daunting to people who are not familiar with APIs and how they work. speaker-1: What are the like? You're this person who's never done this before. What are the like first things that like terms, jargon, whatever that that people need to get really just get their mind around understanding before they then go, OK, I understand these things. Let me actually go and prove it. speaker-0: Yeah, so the first thing to understand is that APIs are not actually that complicated. They follow a very specific set of rules. There are some variations to the rules, but generally, it's quite simple. ⁓ APIs have a set of verbs that are used, and API calls are used to get information from a data store or contribute new information to the data store. And there are just a few verbs. You've got your get, which is your request to get information. You've got your post, which puts information in the data store. You have your put, which updates information that's in the data store. And then finally, you have your delete, which removes information from the data store. So that's basically all APIs do. Then you can also think about the structure of the API request. If you have a get request, really all you're doing is you have a URL and you've got your verb get and you just get the stuff back. When you have a post request, you're sending in information and so then you need to think a little bit more about how that information is going to be structured. But that is exactly how you get started. It's just to think about it in that way. You've got your URL, you've got your verb. and then maybe you have information that you're sending in in the body of the request. speaker-1: Yeah, and I think it's important that people realize, at least for me when I was getting into a lot of the spaces that, because I moved from being a tester into engineering and went through that, ⁓ is that everything is programmable and easily done. And when I say programmable, I don't mean you need to understand the programming language. to do API testing. Curl is perfectly all right to do basic API testing. And you can build automation off that really simply. And I think that for me was kind of guiding a few people, was always the thing that people always got stuck on because they were like, oh, terminal's scary. This is scary. This is scary. It's like, you're working with software that's full of bugs. You shouldn't be scared. The part is if you lose data, that's the scary part, right? And so one of the things we said in the introduction is that you kind of encourage people to do API testing because UI testing can be flaky. ⁓ How do you recommend people going from, I've got this flaky test to go, speaker-0: Yes. speaker-1: ⁓ let me build out some better API tests, and then maybe I can get rid of this UI test. speaker-0: Mm-hmm. Yeah, I think definitely the way to get started would be to first start making API calls without automating them. And there are tools to do that. Postman is one of the most obvious choices. Another tool is Bruno. Bruno is sort of like a stripped down version of Postman. And so learn how the API calls are made, what kind of, excuse me. what kind of token you need to pass in in order to have permission to get the response. Get all of that working first. Once that's working, then you can start automating it. And I would recommend when you're writing automation and you want to get into API automation, just focus on the API automation first. Once you've got some API requests coming in and you're getting responses through the automation, Then you can take a look at your existing UI tests and you can say to yourself, how can I make these UI tests faster and less flaky through using API calls? So then you're sort of combining the two. But when I learn anything new, I always like to take it one step at a time. I set myself a small goal, like, let's see if I can just get this token back, you know, so that I'm logged in. And now let's see if I can use the token to get information. So one step at a time, and then you just chain on that. speaker-1: It's funny. It's something I've said to people in the past that they should be doing as well. Login is a perfect example. I see a lot of people doing automation of the login process through UI tools all the time. I think it's probably the most tested thing. And it's becoming incredibly difficult nowadays to get through those processes as we add more security layers to it. 2FA, MFA type of things like that. So two factor authentication, multi-factor authentication. And then you've got to try to do all of that. And it's like, what if you just had a mechanism purely for testing that goes, hey, here's your web token. Inserted in, now you're good. And all the UI tools allow you to do that these days, which is really good. And I think that then alleviates. some of the pressures because ⁓ the thing I've always said is like an automated test should have three things. It should know where it's starting. It should do one thing really small but really well and then reset back to one so that nothing, everything is atomic the whole time. So you can just run that one test. Is that something you found when you've been speaking to people that like people get like overwhelmed in that way. They're like, I can't mix these two together. speaker-0: Yes, there's definitely that, I think the thing that I even caution people more about is why are you running the test? So if you imagine, you know, in a work situation, you might have some old legacy automation tests that have been sitting around for a while. They've been flaky. Nobody's trusting them anymore. You want to... them over to a new framework or you want to introduce some API calls in them to make them less flaky. When you're starting to work with that test, don't just say, ⁓ here's the test and so I need to do all the steps that were in this test. Ask yourself, why am I running this test? What is the purpose of the test that I'm running right now? Because sometimes when you look at it, you might discover that there are steps in the test that you really don't need. I don't need to validate this thing, I just need to validate the thing at the end of the test. So I advise people to take a step back and look at that first. speaker-1: Yeah, definitely. One of the things I enjoyed when doing API testing was making sure, because I tried to do a lot of negative testing when it comes to this. So for the audience, if you don't know, negative testing is like trying to make it fail and putting it there. Like, so it's the opposite of like happy path testing. My favorite, when I used to do that, was try ⁓ insert weird and wonderful ⁓ ASCII characters into everything ⁓ and then try kind of do that. So the one that I used to do was I used to kind of make up a story of ASCII characters about a snowman and the last one would always be the snowman in there. And it's amazing because I came from a, like, I started in .net and Python and I did a lot of stuff there. Python was awful when it came to understanding anything that was not ⁓ pure ASCII. It went into Unicode, like the language, which just started failing. And this is, I'm showing my age at this point, right? Like this is an old, much older versions of Python. Have you got any like fun stories where you've like gone down there and gone, hey, here's this wonderful, weird and wonderful bit of data and it's literally crashed the system? speaker-0: Well, my favorite thing to do, it is so fun that you mentioned a snowman, because my very favorite thing to do is to try and insert all of the lyrics to Frosty the Snowman into every field. And so I actually, usually with every job I have, I have a text file with all the lyrics to Frosty the Snowman in it. And then if I'm doing, and this, do this for UI and for API. So if I'm doing an API post, and there's a field, like let's say it's first name or something like that, I just put all the lyrics in there and then hit send and see what happens. mean, and obviously what I should be getting back is I should be getting back, ⁓ this text limit is only 20 characters or whatever. So I like to do that everywhere. I have so much fun with that. ⁓ Another big one is phone numbers. I've tested phone numbers. quite a number of times in my career and phone numbers are just crazy. mean, even just in the United States with the traditional 10 digit phone number where you've got your area code, maybe it's, no, it's 10, area code and then your exchange and then your last four digits. ⁓ There are so many things that can go wrong with that. Do you have the dashes in between? Do you have the parentheses around the area code? Do you have a country code at the beginning? And so I love trying out those combinations and I always find so many ways that it can go wrong. You try to do the post and the system either accepts it and then you've got bad data in there that then doesn't display correctly or it rejects it with a 500 so it doesn't give the user an appropriate message to know what to do next. speaker-1: Yeah, I think phone numbers, phone numbers, dates and times, I think are the usual suspects of everything. worked for multinationals because like you said, in the US it's 10, the UK it's 11. And so India, it's even more, I think. I could feel like it feels like it's more than 11. And it just goes up and up and up. And you've got all these different things. It's a problem that I recently had when I was out visiting the office in India recently. I was like trying to put all my details in. It's like, can't put my UK number, even though this is the number you're asking me for. Eventually, I just gave them the office number. So, but it's that type of thing where people have to be, have to work around all these fun things and you only learn about it by kind of trying to break it down. And I think testers are amazing at being able to like, just think slightly outside of the box. So I like your version. Snowmen in general, I think, will likely break a system by the sounds of it. speaker-0: Yeah, another great one ⁓ is postal codes. In the United States, postal codes are usually, ⁓ five digits or sometimes five digits with a dash and then four more digits. And I live in New England and in New England, your postal code starts with a zero. And that breaks a lot of things. If the developers who are working on the project don't know that the postal code can have a leading zero, suddenly you can find yourself not being able to sign up for something because you're putting in your postal code and it's telling you that that's not a real postal code. Well, yes, it is. It just starts with zero. speaker-1: Wow, OK. Yeah. And another one for the audience, postal codes in the UK are normally ⁓ seven characters. And you can use your postal code as a substitute for GPS in the UK, because every street has their own postcode. ⁓ That then creates other problems because major cities have slight variations on what makes it up because it's ⁓ two letters, two numbers, three numbers, two letters. But then somewhere like London, it'll be like two letters, ⁓ one number, another letter. then it just gets very, I remember doing all of that stuff. ⁓ It's always fun talking about data because then you can see like the amount of data that people have to try think through and then go, ⁓ actually, this is a really interesting problem to solve. my next question really is like, is around myths. And what is the one scary myth that you've seen crop up around like API testing and like you just want to say to people, I hate it when I hear that. Let me debunk it. speaker-0: I think the myth that really drives me crazy is basically like we can't test that. Like, and, you know, there's often different excuses. We can't test that because it's internal only, or we can't test it because we don't have the right token to test it with. ⁓ like those kinds of things. I mean, but I always counter with whether I hear this from the tester or whether I hear it from the developer, like I counter with, how do you know it works? And so, you know, eventually if you keep asking that question, you're going to find the developer who says, ⁓ well, I know that it works because I coded it and because it works like this. Okay, well, if it works like that, then we're going to know how to test it, aren't we? So I think that's probably the biggest thing is, we can't test that. speaker-1: Yeah, I think that that excuse note is no longer even valid ⁓ in especially in the age of AI. Right. I think kind of like the because you just go, I want to test this thing. And you can just iterate over the output that AI generates, but you will get a test at the end. And I think it's even more important nowadays that we start getting developers to think about how they're going to test it because testing generally is how people are going to use it. I think there's a very good correlation there. And it gives you a space to go, well, I've got a good test of how I think people should use it. Now I'm going to create the implementation, or not, whatever. And you go, if you're using AI, you just go, it needs to make sure this test pass. Do not change the test, create the implementation. And I think that's... One of the things I've been talking to people about recently is that I think nowadays testing is far more important in the age of AI. ⁓ And that is in itself a topic that we could deep dive into. ⁓ But I think that kind of gives us a nice segue into the next bit, where I think you've famously talked about kind of like your love-hate relationship. I think it's a nice way to put it, with AI. ⁓ Mostly because you see it as a double-edged sword. I agree. I see it as a double-edged sword. ⁓ So ⁓ let's explore some of that tension. And I think it's important that people know that it's a... This is not going to be a, don't use AI or use it. It's like, be aware of the following limitations, as always. ⁓ You've cautioned on the over-reliance of AI. ⁓ and that can stop people from doing their own problem solving. Where is the line between AI as a tool and AI as a crutch for you? speaker-0: think for me, the most important thing is that we're always thinking. We're always using our brains. And I think when people have a problem or have a question that they want to investigate and they start with, let's go to AI for that, then they are missing the work that you do in your brain when you think of things. And that is what makes us as testers so valuable is because we're always the ones who, or we should be the ones who are sitting around going, how can I break this? What else could I do with this? What would be a really weird thing that could go wrong with this? And if we stop doing that thinking first and we go straight to, hey AI, tell me how to test this thing. We're gonna miss those little gems, those little ⁓ gotchas that maybe we've seen before elsewhere in our career. ⁓ Maybe AI will get it, maybe they won't. ⁓ But even if they do, even if they do think of everything that we've thought of, it's still the mental exercise of using our brain. mean, the brain is like a muscle. You have to use it or it's gonna atrophy. So I like to, when I'm... You know, working with something new and I'm thinking about how to test it, I like to think about it by myself first. Sometimes I might even like write stuff down as I'm thinking or type it in a list as I'm thinking. And then I'll go to AI and say, you know, hey, here are all the ways that I've thought of to test this. Do you have any more? So it's always using the brain first. speaker-1: Yeah. the way, ⁓ so on a previous episode, I had ⁓ Marit on there and we were talking about kind of exploratory testing, training new people to be exploratory testers. And the way she described it, and I love it, is that ⁓ AI is a tool to extend your imagination. Right. And I think that's what you've said is that like, I've got this, but like, My imagination's only gone this far. Help me extend it, right? The way I've been doing it recently on some open source projects that I've been working on is I go to AI. like, I've got this problem. Let's talk about the planning on how I would go around doing this. Not any implementation, just pure planning. then that way I find the... For me, it allows me to move a little bit quicker ⁓ through that, like what you've done, where you step away. I kind of step into it and go, let's do this together. And then it's like, but I I already have basic ideas of where I'm going to do it. We will get it from like the years of experience from doing the job, right? It's like, you can have your five, 10 tests instantly and you go, right, okay, cool. Let's do this. And you iterate. ⁓ and I find that quite useful as a tool, but I would never use any of that blindly. And I think that's the key thing you were trying to say here is that like this blind use of AI, ⁓ creates more problems than it's actually good. ⁓ and I think it can lead to, ⁓ AI drift, AI hallucination, because kind of it's like, it thinks it's still doing the right thing, but it's clearly wrong. ⁓ Have you ever like, what's your like worst case of like AI hallucination that you've come across in your job or kind of where it's like, I think I'm done. And you look at it, you're like, wait, have you even started? speaker-0: Yeah, so I had one a few weeks ago and these aren't the exact details because I don't remember the exact details, but I had some code. I was trying to do an assertion of some kind and ⁓ I could tell the test was not working the way it was supposed to. It wasn't finding the elements that it needed to or something like that. And so I said, hey AI, Why isn't this line of code working? And it said something along the lines of, I know what your problem is. You need to make this into an array. And then you can deal with the elements in the array and that will solve the problem. So I said, okay, thank you AI. And I went in and I made it into an array instead. And then it still didn't work. And so I said, okay, it's still not working. What's going on? And it said. ⁓ I know the problem. needs, it shouldn't be an array. It should be a linked list. So change it to be a linked list. Like, okay, all right. So I changed it and then it wasn't working. And then I said, still not working. ⁓ well it needs to be an array. So it was just going around and around. like, okay, I'm done with you now. I'm going to solve the problem myself. speaker-1: Yeah. ⁓ I like to call that weird thing where it gets itself into a loop. I call it a death spiral because if you keep using that context window, it's literally going to get worse. Yeah. And it will just start hallucinating like very easily. ⁓ My latest one, I was working on the Selenium project recently and I'm trying to get some code. to be also generated for the Selenium project because it's coming from the WebDriver by die spec. And I've this problem, explain it, I do my usual. Let's plan this through, let's have a look. And this is how I'm thinking. We go through it and then it goes, I'm done. And I went, I don't think so. I run the tests and there's compilation errors, there's everything. I'm like, dude. I even told you how to run the test. Do not change the test. Here is the target for running the test in the command prompt. Just do that. And it's like, yeah, I'm done. And you're like, no, I think you've made it worse. Let's just, I literally deleted everything it had done and then started from scratch again, because the context window again, went crazy. ⁓ And I think people need to be aware of like, the longer your context window has been open, easier that the AI is going to be for you and it will literally make your life hell. ⁓ So we've talked about the bad side. On the love side, how can testers use AI to discover what they don't know? And we need to admit we don't know everything. ⁓ And so from programming to API to whatever, how are you helping yourself use AI to learn and How can other people do it? speaker-0: Yeah, so this a big thing that I've said in my books and in my blog posts is it's very important to know what you don't know. And then when you know what you don't know, you can start asking questions about it and learn it. And ⁓ AI is so great because AI can actually help you to know what you don't know. So if you say to yourself, if you say, ⁓ I need to remember what the thing is where it's got the curly braces and you've got name value pairs in it, but I don't remember what that's called. You can say something like that to AI and AI will say, ⁓ I know what you mean. You're referring to a JSON object. And so then you've got the word that you need and then you say, OK, now AI, please teach me about JSON objects. And it will be happy to do that for you. And another thing that's very useful is if you know what you need to learn and you're really starting from scratch, for example, I needed to learn about GraphQL because I hadn't really tested it yet and I was going to need to do that in the future, I could say, hey AI, please give me some good learning resources for learning about GraphQL. And it'll say, okay, great. And then it'll give you some tutorials or some websites or some practice sites. So it's just, it's a great way to find that information and take your learning that next step. speaker-1: Yeah, no, I like that. And I think, especially because AI tends to be a people pleaser. It never tells you you're wrong. Like if you're asking it to help you learn something, it will try its best to make sure that it's hitting that as a marker. ⁓ Have you ever tried using ⁓ AI to when you're like, ⁓ how do you do this or explain this to get it to describe something as if you were five. Have you ever done that? speaker-0: Yeah, I have done that. Yeah. And actually my, the way that I thought to do that is actually it's from a wonderful Angie Jones video from several years ago where it was actually explained machine learning to me like I'm five. And it was just a wonderful video. And I thought, ⁓ that's just such a great way to ask the question. So yeah, yeah, definitely asking AI to keep things as simple as possible can be super, super useful. speaker-1: Yeah, I've even asked it to like explain it to me like I'm five, but generate a cartoon, like a set of cells in a cartoon to explain it. And it's like, oh, okay, now that makes perfect sense. There's been a few things where I've done that. Obviously, your mileage will vary depending on which AI tool and how many tokens you have available in your account. If you were starting, like because we've done the love, we've done the hate. ⁓ you've done mentorship. like if you were like doing mentorship, a new starter, junior in the space, how would you have them kind of still make sure that they are using their kind of critical thinking ⁓ and getting all of those things into place while having all the benefits of these tools around them that kind of, you know, from I've been in the industry slightly longer than you. And I've gone through having to do everything and just like a notepad to kind of having full blown IDEs to make my life easier. And it changes the way you think about problems. But how do you help people starting in the industry still think critically to be amazing testers that we hope that they will be? speaker-0: Yeah, I think I Guess it comes back to the first thing I said which was always do your you're thinking on your own first ⁓ So that would be like if I had a team ⁓ of Newish QA engineers I was working with I would say hey, you know what? We've got this AI tool that will generate test cases, but please You know think about it yourself first make that list first and then ask AI and then see which ones you missed. And if it finds things you missed, then that will help you, you'll remember that for next time. Because it's like, if you give somebody a quiz and they missed two questions on the quiz, they're always gonna remember those two questions that they missed. ⁓ I missed that one. So I would encourage them to do that. And then in terms of writing test automation, ⁓ In order to get started with AI, would have them, know, either, you know, maybe in their company, they already have AI integrated into their IDE, or maybe that's just an option that they could do. But once that IDE is there, I would have them just start asking questions about the code. Like, and I do this all the time. If I'm looking at somebody else's code, if I'm reviewing their code, and I see line 37, I don't really understand what it is that they're doing there on line 37. I ask the AI, hey, what's happening on line 37? Why are they doing that? And usually the answer is correct. So that's very useful. So that can really help you understand what's going on in the code. And then one other thing that I discovered that AI could do that I was so, so happy about is element locators. If you grab a bunch of HTML that's on your page and you give it to the AI, you say, hey, here's the HTML that is in this section of the page. I need to grab this element right here. How would I do that? It usually gets it right. And that saves so much time because when we're writing UI automation, At least for me, was always 90 % of the time was just getting it to find the thing on the page that I could see on the page. I know it's there, but for some reason I don't have the right incantation to get it. So AI really helps with that. speaker-1: Yeah, definitely. ⁓ I'm just curious ⁓ because you've done both. DevTools for years have had the ability to just like right click on an element, open up the DevTools and then like ⁓ Winch then puts you on it. And then you can just like right click and copy the element locator because it's normally like CSS or whatever. ⁓ Do you do you find the AI one is more robust compared to that way of doing it or more succinct or like what is it like? speaker-0: think where the AI excels is to find those tricky nested ones. The ones I always struggle with are the dropdown. You've got to click on the dropdown, the dropdown opens, and then you've got to find the element in the dropdown and click on that. Those are the ones that always trip me up. If it's just a button on a page, that's always super easy. I just use DevTools, I right click, I say show me the element, and then I can see all of my different options. ⁓ I've got a data ID here, I can just call that. Or I've got, you know, this is the ID of the element, I'll just call that. But it's those tricky multi-step ones where it's like you have to get your pop-up and then you have to find the element in the pop-up. Those are the ones that I like to use AI for. speaker-1: for. Okay, awesome. Amazing. ⁓ So we're gonna head into our final section. And this is a quick via round. It's a this is basically because I like to waffle and it stops me from waffling. Because I have to ask you a question, you have to give me a succinct answer as possible. And then we go from there. ⁓ Are you ready? speaker-0: I am ready. Bring it on. speaker-1: If you could remove one outdated practice from QA across the globe, what would it be? speaker-0: going straight to UI automation instead of automating things a different way. speaker-1: Awesome. ⁓ One book every QA lead should be reading this year. speaker-0: Explore It by Elizabeth Hendrickson. speaker-1: She's so phenomenal and she's a phenomenal writer. speaker-0: Every coming out in the fall that I just heard about speaker-1: ⁓ OK. So hopefully that will come up in later episodes to kind of remind people to go by it. ⁓ What is the most underhyped QA metric? speaker-0: think the most important metric is who found the bug. Was it the team that found the bug or was it the customer that found the bug? speaker-1: Cool. Why does the world still need human testers in the AI era? speaker-0: because human testers still have a creativity that AI will never possess. speaker-1: And final one, if you went in testing, what career would you be doing now? speaker-0: Probably teaching. Before I was a software tester, I was an elementary school music teacher. I don't think I want to go back to that, but I do really enjoy teaching people, so I think I would find a way to teach people in some capacity. speaker-1: I think the world needs more musicians at the moment. There's not enough of them. Awesome. Thank you for your time, Kristen. This has been an absolute masterclass in thinking like a tester. Thank you for sharing your thoughts and insights along the way. ⁓ Kristen, where can people find you, look at what you're doing, learn from you? speaker-0: All right, well, I've got a website called thinkingtester.com. So you can check out all the resources there. You can also connect to me on LinkedIn and on X. I post a lot more on LinkedIn than I do on X, but I'm still around. Yeah, and then I've got three books that you can find on Amazon. Got that LinkedIn learning course about Postman where you'll learn all about API testing. And then my free YouTube course, which is called Monday Morning Automation. And that helps you learn automation from absolute square one, knowing nothing. speaker-1: Amazing. ⁓ To the audience, as always, please hit the Subscribe button to kind of catch up on this and future episodes of Browser Stack Talks, where we will kind of be talking to amazing people, turning testing pain points into playbooks. ⁓ Thank you for joining us today, Kristen. I really appreciated it. speaker-0: Thank you so much, this was a lot of fun. you