DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Databases
  4. Problems Missed When Only Testing APIs Through UI

Problems Missed When Only Testing APIs Through UI

Learn why testing your API specifically through the API layer is essential to ensure its functionality.

Patrick Poulin user avatar by
Patrick Poulin
CORE ·
Sep. 22, 18 · Opinion
Like (1)
Save
Tweet
Share
5.24K Views

Join the DZone community and get the full member experience.

Join For Free

UI testing is an important part of quality assurance. Specifically, UI testing refers to the practice of testing front-end components to make sure that they do what they’re supposed to. If a user clicks the Login button, the login modal appears. If they click a link, they’re brought to the appropriate part of the application. With automation platforms, these individual tests can be linked together into workflows and automated. Business-driven development style tests can be created in this fashion. The UI can be tested to see that each individual path that a user may take is functional and that the interface is responding appropriately. Other platforms exist that allow these workflows to be tested on simulated resolutions and devices, ensuring that the user experience is consistent across all possible combinations of browser and device.

API testing lives a layer below UI testing. The UI is fed by these APIs and renders the DOM based upon conditions set by both the user and the developer. These conditions determine the sort of API call that’s made to populate the viewport. When we’re UI Testing, it could be argued that we are indirectly testing the API layer. It’s actually pretty fair to say so. Many of the actions that our UI platform will take will issue API calls. If the DOM rerenders correctly, we can assume to an extent that the API call was successful. The dangerous ground here is the assumption.

Let's use a retail web application as an example. Our UI platform can log in, execute a search for a product, add the product to the cart and check out. Every step in the chain is successful, which is great news. Our site is behaving as it should and we can deploy. A few weeks after deployment, we take a look at our sales numbers and 15% of our products are almost completely unsold. It turns out that those individual product entries in the database have a null field that prevents them from ever appearing in a search. It was an unfortunate data entry error, but there was no validation on the database side that prevented the entering of this null value. The products still appear if a user views all products, which would account for the limited number of sales, but they never appear in a search.

The above problem is one that we have actually encountered at API Fortress, and the unfortunate fact is that a UI Testing platform will never even see this issue. The client was unable to figure out why sales for certain products were disproportionately low. When we tested the API layer, we found that a large number of products failed to meet schema compliance for the API. As a consequence, they could be pulled with an “all products” or “single product” call, but not with a search. As most users leverage a search function to find what they want to purchase, the company was losing sales. Once we tested the API layer, we found the problem quickly. This allowed the client company to fix the database entries and give their customer base full access to their product line.

The commonly held belief that UI testing inherently tests the API layer is built on an assumption. The assumption is that it tests the API layer thoroughly, or even thoroughly enough. This can be a very dangerous assumption for a QA team. Testing the API layer, which typically goes through changes at a slower pace than the UI layer, allows a testing team to first ensure that the data being passed to the UI is formatted perfectly and that the server is responding appropriately. Once this process is done, UI Testing can verify that the front end is working properly. Without testing the API layer, silent errors in business-critical processes can remain silent.

API

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Journey to Event Driven, Part 1: Why Event-First Programming Changes Everything
  • Create Spider Chart With ReactJS
  • Microservices Testing
  • Choosing the Right Framework for Your Project

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: