Karate is a popular open-source project for web-service API testing. Inspired by Cucumber – it combines BDD syntax with a DSL carefully crafted to deal with HTTP. In this episode, Peter will walk through some of the features of Karate, and how it can be effectively used for testing web-service APIs. You get to hear straight from the creator of Karate the motivations for creating this framework in the first place, how it differs from the competition, and how it helps accelerate the development and quality-assurance of web-services of all kinds
About Peter Thomas
Peter is a full-stack engineer who loves building and mentoring technology teams. An avid open-source enthusiast, Peter’s first open-source project ‘CB2XML’ was created on SourceForge in 2004 and incredibly still sees active releases by the current maintainers.
Quotes & Insights from this Test Talk with Peter Thomas
- What got me started creating Karate was that I had to look at a particular test suite almost two years ago in my team and I didn’t like the look of what I saw. I am a little in particular about the way I write Java code and so on. And this particular in-house framework that was being used by this team it was kind of homegrown based on the Apache HTTP client and all the usual suspects. And I found it really hard to understand what was going on, how to debug. There were layers and layers of code because various people had come along the years that tried to add improvements and then added more you know edge cases and features and framework stuff. Which I think you kind of did more harm than good. I didn’t like at a high level and like what I was seeing in terms of what was happening across the company in terms of how people approached API test automation and I thought there needed to be a better way and I kind of decided to try to create something on my own and that’s how it all started.
- Karate primarily is a framework for testing any web servers API. So it’s very good for rest services and it can do soap as well. And even GraohQL which is you know kind of picking up right now as a technology option. But Karate is what I like to think of it as one of the world’s best HTTP clients. It can make all kinds of HTTP request. And all the edge cases that he can think of like file uploads, form authentication of URI encoded form submit and all that. But I think a lot of people are kind of underappreciated that Karates real strength i sin asserting JASON responses.
- Karate is mainly used for rest services but it can test SOAP. When I created the all general prototype of Karate I was actually having to test a SOAP service. Karate has excellent support for XML because I kind of build it in from the start it may be a surprise to many that JASON kind of came in phase two.me it’s about the audience and I don’t want to alienate the audience by saying you should do this and that it should be more conversational.
- I personally think that Karate is actually quite accessible to people who don’t know programming. One of the great things about HTTP is that it’s plain text right at the very simple. It just boils everything down to first principles in a way. And I personally think that’s why REST is so successful and you why a tool like Karate embraced those principles.
- Performance testing as a capability of Karate was released I think in June or July sometime around that timeframe. I think it’s pretty cool. It’s actually in my mind and I think I have been chasing this for years. Whenever I had to get involved in the past in varies companies to do testing I’d always found it irritating to know you have a bunch of functional tests but then someone needs to go and rewrite all those flows into something like JMeter or Gatling or similar tools. And I consider that as the Holy Grail of test automation where you should be to reuse your functional tests as performance tests and Karate can do that.
- In terms of advice, I strongly recommend for people using Karate and having questions. And my advice is please read the documentation. I’ve spent a lot of effort in the documentation and I think it shows that a lot of people who actually complain that there’s too much documentation. But I think that’s a good thing for an open source project it’s kind of rare.
Connect with Peter Thomas
Rate and Review TestTalks
Thanks again for listening to the show. If it has helped you in any way, shape or form, please share it using the social media buttons you see on the page. Additionally, reviews for the podcast on iTunes are extremely helpful and greatly appreciated! They do matter in the rankings of the show and I read each and every one of them.
Powered By SauceLabs
Test Talks is sponsored by the fantastic folks at Sauce Labs. Try it for free today!