March 26, 2017

New automation framework released to test APIs: Introducing Karate, by Intuit India's Peter Thomas

After spending the past month attempting to finish blogging about the API testing framework, REST Assured, I came across today the following item that had been retweeted:



According to Peter Thomas' LinkedIn profile, he has been an architect in Intuit, working for Intuit India ( @Intuit.In ) since 2012 and lives in the Bengaluru Area, India.

Peter even has Google Doc he posted about on March 20, 2017 comparing and contrasting Karate vs REST Assured.

*sigh* Sometimes it is so hard to keep up.

Here is some information from around the web about this new automation framework. During my next lull in work, I need to tinker with this!

Karate: Web-Services Testing Made Simple


From Peter Thomas' Medium article, Karate: Web-Services Testing Made Simple, posted on BLUEPrint by Intuit's Medium.com account:

"Intuit has open-sourced ‘Karate’, a framework that makes the tall claim that the business of testing web-APIs can actually be — fun.

"I know what you must be thinking. There’s no way that making HTTP requests and navigating the forest of data that is returned could be fun.

"But really, that’s what developers who tried Karate had to say. It actually didn’t surprise us. Because Karate was born out of a strong dis-satisfaction with the current state of solutions that exist. And a lot of thought went into Karate to keep it simple and elegant, to allow the user to focus on the functionality instead of boiler-plate, and to keep things concise.

"Karate strives to reduce the entry barrier to writing a test and more importantly — reduces the friction to maintain a test, because of how readable tests become [ Read More ]".


Karate's GitHub Site

From https://github.com/intuit/karate:

"Karate enables you to script a sequence of calls to any kind of web-service and assert that the responses are as expected. It makes it really easy to build complex request payloads, traverse data within the responses, and chain data from responses into the next request. Karate's payload validation engine can perform a 'smart compare' of two JSON or XML documents without being affected by white-space or the order in which data-elements actually appear, and you can opt to ignore fields that you choose.

"Since Karate is built on top of Cucumber-JVM, you can run tests and generate reports like any standard Java project. But instead of Java - you write tests in a language designed to make dealing with HTTP, JSON or XML - simple".


Peter's Hello World Example

Feature: karate 'hello world' example
Scenario: create and retrieve a cat

Given url 'http://myhost.com/v1/cats'
And request { name: 'Billie' }
When method post
Then status 201
And match response == { id: '#notnull', name: 'Billie' }

Given path response.id
When method get
Then status 200

On the site, Peter talks about how to get started, variables and expressions, data types, primary HTTP keywords, tips, and examples such as data driven tests, and how to use it with *.feature files.

Over ten demos are on the Karate Demo Page: https://github.com/intuit/karate/tree/master/karate-demo

Watch Joe Colantonio Talk About "Karate a Rest Test Tool – Basic API Testing"

Joe Colantonio, creator of the Test Talks podcast, just published on March 23rd an article, Karate a Rest Test Tool – Basic API Testing, which includes a mini tutorial:

https://www.youtube.com/watch?v=yKRR1j0A9Q4

You can get more instruction from https://www.joecolantonio.com/2017/03/23/rest-test-tool-karate-api-testing/

Follow Karate DSL on Twitter!

And, yes, you can follow Karate on Twitter:

Watch a Webinar from the Creator, Peter Thomas

TechGig published a webinar, "Karate: DSL for writing web service API acceptance tests, BDD":

"In this session, Peter will walk through the features of Karate, demonstrate how it handles manners of HTTP aspects such as file-uploads and cookies, and also explain how it can be extended via custom-functions in either JavaScript or Java. Karate's innovative plug-in mechanism for HTTP-header management makes integrating any kind of authentication and sign-in flow extremely simple. You get to hear straight [from] the creator of ‘Karate’ the motivations for creating this framework in the first place, how it differs the competition, and how it helps accelerate the development and quality-assurance of web-services of kinds, be it REST, SOAP or GraphQL.

"Key points of discussion:
  • "Why Karate was created, and what problems it solves well.
  • "Examples and demos of real-life web-service API tests using Karate.
  • "The architecture of Karate and how it combines technologies such as Cucumber, JsonPath and Nashorn.
  • "Insights into what goes into open-sourcing and releasing a public Java project".

https://vimeo.com/209699865

Happy Testing!

-T.J. Maher
Twitter | LinkedIn | GitHub

// Sr. QA Engineer, Software Engineer in Test, Software Tester since 1996.
// Contributing Writer for TechBeacon.
// "Looking to move away from manual QA? Follow Adventures in Automation on Facebook!"

1 comment:

Tom James said...

Awesome post, keep it up. I always recommend this blog.
Also visit us by Click here

karate