Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

API Mocking for the REST of Us

DZone's Guide to

API Mocking for the REST of Us

Learn how ServiceV Pro, an API-specific service virtualization tool, takes API mocking to a whole other level.

· Integration Zone
Free Resource

Today’s data climate is fast-paced and it’s not slowing down. Here’s why your current integration solution is not enough. Brought to you in partnership with Liaison Technologies.

[This article was written by Paul Bruce.]

Fellow geeks and API nerds: Have you ever worked with mock APIs before? Ever had to wait for code to get deployed just to start testing? Ever wanted to just prototype an API without getting lost in the weeds? Ever have problems testing 3rd party APIs?

Oh my goodness, this beat is so hard. You’ll want to listen up.

ServiceV Pro is an API-specific service virtualization tool in our API readiness platform (Ready! API). It takes mocks to a whole other level, and we’ve just taken it past that again with the new Ready! API 1.4 release. No joke, now you can:Ready!API1.4

  • rapidly stub out API designs and new endpoints
  • share virtual APIs (we call them “virts”) between team members
  • take control over simulated responses and performance conditions
  • create advanced mocks from real-time API traffic

It really makes development and testing way easier to have tools like ServiceV Pro in the mix, especially with the brand spanking new stuff we just included. Control is a powerful thing to have as a tester, developer, and manager. Control over 3rd party API use, over your own costs, over making your deadlines on time. Control is how we get to the next level.

Record-to-Virt

Let’s say you have an app or integration that connects to an API, but something changes as it always does and now your mock is old hat. It’s out of date, either because there was additive change to your API like new endpoints or optional parameters, or because there are clarifications to existing requests. Parameter data might also change the responses coming back from your API.

Or maybe you don’t even have a mock…or an API description (for all you REST cowboys and cowgirls out there). Bummer. Real bummer, but in the real world we don’t always have the perfect documentation on APIs that we either inherit or aren’t formalized yet.

Don’t you wish there was a hassle-free way to build and update mocks from what you already have?

As it so happens, ServiceV Pro now acts like a high-performance proxy and includes request and response recording capabilities that do exactly that: record your traffic as high-performance mock operations. This is what we call a “virt” (virtual API), because frankly it’s wearying of having to say all that other stuff. A virt brings the concept of API mocking down to Earth, no need to set up a whole new stack, and no need to write a single line of code.

ReadyAPIPicSo now you can start from an API descriptor (like Swagger or RAML) and build out a virtual API with the flick of a wrist, like Harry Potter, if that’s your sort of thing.

Fast API Switching

For those of you undeterred by the level of geekery in the previous paragraphs, here’s where it gets really real. Subtract the recording aspect we just reviewed for a second. Once you’ve got your mock virtual API “virt”, you can have clients either receive the fake responses and stop there, or you can flip routing on again to let that traffic go to the actual API.

This makes you a modern information surgeon. I told you control is a powerful thing.

Take for instance load testing. The amount of data produced in a load test can be staggering, which is why we often visualize it in aggregate and make pretty graphs show us what’s going on instead of looking at the matrix code that is performance data. But in aggregate, the detail on which host and what endpoints can be lost.

Fast switching in load and integration testing is essentially fault isolation, and as every good engineer knows, is a great way to figure out what exactly is broken or performing poorly. So during a test, when you see something funky in aggregate (like exceptionally slow performance in an endpoint or multi-step workload), you can start flipping the switch on certain mocks to remove them from the equation. After a few moments of trial and error, you quickly find which APIs are causing your problem.

Ready!API1.4-2Go ahead, be that person that solves things in so little time that everyone’s a big jelly sandwich. Things will start to change because you’ve exercised the right kind of control.

Oh, what, whatchu sayin’, there’s more?

Come on, you didn’t think we’d only include cutting-edge functionality in just one tool in our API Readiness platform, Ready! API, did you? Please. Of course there’s more!

In SoapUI NG Pro, we’ve massively revamped the functional testing transaction history view, including the ability to baseline snapshots of how the request/response occurred at a previous date, but also the ability to compare for differential what was working in a baseline yesterday to what’s failing today.

Ready!API1.4-4

Picture yourself, in the morning you come in, sit down, check email, and find a bunch of notifications that your automated test runs are failing. Crap. So you open the test suite up, look at the case that’s failing, but now what? Well, last time you messed with it, you were smart enough to hit the ‘Archive’ button to mark it as the last baseline that worked. Now you can run the differential and find out exactly what changed for a better sense of why the test is failing. Better insight, quicker diagnosis, and you’re home in time for dinner. Tasty dinner, mmm.

Even more? Yes, always, more!

There’s a lot more, we fixed a bunch of bugs like good software vendors are supposed to. We had to. At SmartBear we’re compelled to make software the likes of which the world has never imagined. We also added features to LoadUI NG Pro, like a scheduler and simplified “URL copy-n-paste” load tests. The technical release notes are somewhere around here, I swear.

And then there are the plugins. Yummy integrations. Git, JIRA, Swagger, Microsoft Azure, Restlet, and on and on; it makes me feel like I’m at a MUSE concert again. The robots surround us, especially in the age of the Internet of Things, which is why we are the only API testing tool that supports both major IoT protocols, MQTT and CoAP.

If you think SoapUI NG only does SOAP, think again. Drink that coffee and read the news. We are the company that does software quality for the connected world. And if you aren’t part of our community yet, we can’t wait for you to join and come with us on our rocket skates into the future.

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and iPaaS+ could cost you down the road. Brought to you in partnership with Liaison Technologies.

Topics:
api ,rest api ,virtualization ,integration

Published at DZone with permission of Denis Goodwin, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}