It’s been a long time since I have heard this tagline “API ABOVE GUI “ from many official testers within my friend circle and others .When I put some effort in realizing the fact behind this, I came across 2 reasons:
2)The Internet of Things .
With Agile development becoming the standard in most organizations, the ways in which we develop software and automate tests have changed dramatically. Graphical User Interface (GUI) tests that go against a user interface tend to take longer to run. During certain Agile practices like continuous builds, the amount of time it takes to receive feedback from a GUI regression suite of tests when new code is checked-in is too long. In those cases, quicker feedback is needed. Agile has also increased the frequency with which applications are released, which in turn has created an increased demand for new ways to quickly test them. GUI tests are typically too slow to get the test coverage we need during, say, a typical two-week sprint. Also, since Application Program Interface (API) tests don’t rely on a UI to be ready, they can be created early in the development process.
The Internet of Things
The second change that is causing a shift towards API testing is the Internet of things. The Internet of Things is an everyday object with embedded functionality that allows it to talk over the web using HTTP or HTTPS to communicate with remote backend services.
Basically, more and more things will begin to have sensors embedded into them. The other day I saw a video of Enchanted Objects: Design, Human Desire, and the Internet of Things author David Rose being interviewed by John Stewart, who showed a medication “glow” cap, that will tell you when to take your medicine by blinking or texting you so that you don’t forget. This is just one minor application, but I’m sure you can imagine the endless possibilities for this type of technology.
So most of the applications are without a definite traditional user interface .
So how do we test this?
This came with the result of API headless testing.
An API specifies how its software components should interact with each other. APIs can be created using a whole host of different technologies. APIs help facilitate communication between a client and a server. We are likely to be testing HTTP/HTTPS- based APIs where communication is done over the web. For example, say we have an internet scale that has an app that makes a request and receives a response from a backend service.
The benefits run over GUI platform as because of following:
If we are testing for a core functionality under a tight deadline we can often go for API.
For example, we executed 30,000 automated tests in a case study. It took 50 hours for GUI completion whereas took 8.5 hours in API.
Data is exchanged through JSON or XML, so any core language can be used for automation .
Easy GUI integration:
Pursuing GUI after API, always give a perfect outline for the GUI stuffs.
Test Core Functionality:
Testing core functionality allows to access small errors, evaluate build strength, test in tandem with development, Improved test coverage and so on.
This in turn leads to faster release, conserved resources & advantageous in-house or off shore QA.