Learning Library

← Back to Library

Shift From UI to API Testing

Key Points

  • Continuous testing drives rapid feedback to developers, aligning with DevOps and continuous delivery principles.
  • Over‑reliance on automated UI tests often fails because UI changes repeatedly break the tests, creating a tension between testing and market responsiveness.
  • A more effective strategy emphasizes extensive unit testing—aiming for high code‑coverage metrics—so that each new piece of code ships with its own tests.
  • Placing strong emphasis on API testing captures business logic at runtime, verifies inter‑service interactions, and safeguards microservice stability as APIs evolve.
  • While UI automation is still faster than manual testing, balancing it with robust unit and API tests yields a healthier, more agile development pipeline.

Full Transcript

# Shift From UI to API Testing **Source:** [https://www.youtube.com/watch?v=RYQbmjLgubM](https://www.youtube.com/watch?v=RYQbmjLgubM) **Duration:** 00:07:18 ## Summary - Continuous testing drives rapid feedback to developers, aligning with DevOps and continuous delivery principles. - Over‑reliance on automated UI tests often fails because UI changes repeatedly break the tests, creating a tension between testing and market responsiveness. - A more effective strategy emphasizes extensive unit testing—aiming for high code‑coverage metrics—so that each new piece of code ships with its own tests. - Placing strong emphasis on API testing captures business logic at runtime, verifies inter‑service interactions, and safeguards microservice stability as APIs evolve. - While UI automation is still faster than manual testing, balancing it with robust unit and API tests yields a healthier, more agile development pipeline. ## Sections - [00:00:00](https://www.youtube.com/watch?v=RYQbmjLgubM&t=0s) **Pitfalls of UI‑Centric Test Automation** - Eric Minich explains that while continuous testing seeks fast feedback for DevOps, over‑reliance on UI‑level automated tests makes the test suite fragile and prone to frequent breakage as the user interface evolves. ## Full Transcript
0:00hi I'm Eric Minich with IBM cloud I want 0:03to talk a little bit about continuous 0:05testing this is a practice where we're 0:08trying to drive really rapid feedback to 0:11development as changes come in how 0:13quickly can we identify that there's a 0:16problem 0:17let development know get it fixed this 0:20really supports DevOps principles it 0:23really supports continuous delivery now 0:26the way we see this done most often 0:31leads to some trouble because we think 0:34all right how are we gonna do it fast we 0:37need to automate some stuff how are we 0:39gonna automate it well our manual 0:41processes well we're working at the UI 0:44level so we should grab functional test 0:48automation or either write some scripts 0:51or do some playback and record and we're 0:54going to test a lot of the UI level and 0:55then we might also say well part of our 0:58product is the public API right so we 1:01should test those API I guess as part of 1:05that we'll do a little bit of API 1:08testing and I guess good code quality 1:12probably helps from some unit testing 1:14we'll do a little unit testing - I'm so 1:18we see this sort of approach this is 1:21also the approach that probably leads to 1:24more test automation programs kind of 1:28failing than any other and the problem 1:32is that the UI is relatively malleable 1:36it changes a lot and so when you start 1:39moving buttons around and renaming it 1:42and changing elements your UI tests just 1:46keep breaking and so as you start out 1:48you have a few UI tests and they're 1:51going well and you start getting more 1:52and more and more and everything keeps 1:54breaking and you end up with this 1:56tension between can I test it and can I 1:59you know actually change things and be 2:01responsive to the market and that's all 2:03kind of anti DevOps so that that's sad 2:06when you're weighted too heavily towards 2:09automated UI testing but even that 2:12that's way 2:13better than manually UI testing is much 2:16faster and better it's the only way we 2:18can do it so we know we need automation 2:21here but we want to flip this approach 2:23right we want to say the bulk should be 2:28unit testing every interesting piece of 2:32code that we write should have unit 2:34tests along with it right this is where 2:38we see principles like code coverage 2:39let's make sure we get 90% code 2:41hundred-percent code coverage on our 2:44unit testing so the code the developer 2:46writes comes with unit tests but then 2:50the real key here and what I find most 2:53interesting is to put a lot of weight on 2:55the API testing particularly in a world 2:59where we're moving to more micro 3:01services but even very true as we were 3:04looking at service-oriented 3:07architectures and and things like that 3:09API testing does a couple of things one 3:13it captures our business logic at 3:16runtime in some of the interconnection 3:19between various pieces and parts of our 3:21applications the next thing is the 3:26easiest way to break all of our micro 3:28services is to have api's start changing 3:31and then a different micro service 3:33breaks if we're putting our api's live 3:36and calling those api's and making sure 3:39they're steady all right or at least 3:42backwards compatible that helps us have 3:44healthier micro service architectures 3:47and so this is a level where things 3:51aren't supposed to change a lot whereas 3:53at the UI level and we're still going to 3:55have our automated UI tests things are 3:59supposed to change a lot they are 4:01supposed to be more reactive to the 4:02market so let's do less testing less 4:07automated testing perhaps that kind of 4:10that most dynamic level more at the most 4:14predictable levels the code levels this 4:18is really powerful this is stable these 4:19are where we see the most successful 4:21transformations towards continuous 4:23testing now if we were to stop here 4:26have nice automated testing story we 4:29would have left out the people and 4:30people are absolutely critical to 4:33testing manual testing absolutely still 4:37has a role in how we deliver high 4:40quality software and so there's a couple 4:42of key pieces here all right we're gonna 4:44want exploratory tests and this is where 4:48we have see if I can spell exploratory 4:51so where we have our smartest you know 4:53good testers going in exploring the 4:57software trying to break things right 4:59looking for things we might have 5:01overlooked and our other tests this is 5:04also a place where you often have 5:07product managers and other people like 5:09that I'm working on the user experience 5:11all right making sure that as they go in 5:14and they see the new features that all 5:16works and it feels good right you'll get 5:18your designers involved here so you've 5:22got these elements and then typically 5:24you're gonna have some real users 5:28actually try the software and I'm just 5:31gonna call this a beta this could still 5:34be you know what's normally called user 5:38acceptance testing it could be in a more 5:44consumer-oriented app it could be 5:46something like rolling it out to 5% of 5:48your users and seeing if they like it or 5:51not you're not gonna do that in a 5:53medical app most of the time because you 5:56don't want to have bugs hurt people so 6:00manual testing still has a role it is 6:04not following a test script right if it 6:07can be written down in a test script 6:08then it could be a UI test but more 6:12likely the things underlying that are 6:15all API calls and you want to put your 6:16testing here at the API level so what I 6:19challenge you to do is make sure that 6:21you're building out your unit tests 6:22making it look less like this more like 6:25that and that you're looking at all of 6:28your UI level tests and saying could we 6:31test the same thing at the API level 6:37then reserve your functional 6:40testing or your UI level testing for 6:44real end-to-end validation that 6:47everything actually works together you 6:51need some of it don't overdo it and make 6:55sure it's the end end sort of capability 6:57it's not small feature function that 6:59could be handled by the api's so I hope 7:02that's a useful introduction to continue 7:05as testing and the biggest gotcha that 7:07we see out there thank you if you have 7:09questions please drop us a line and if 7:12you want to see more videos like this in 7:14the future be sure to LIKE and subscribe