API Testing
API Testing
Streamlined Testing
A typical browser running with a graphic interface has a demanding
job. Every time the user opens a new page, the browser must render
the entire page, including layout, fonts, visual effects, embedded
graphics and videos, and embedded content pulled from other sites,
adjusting the size and position of individual graphic elements as it
does so.
It All Adds Up
When you're browsing in an environment with a high-speed
connection, a fast, responsive server, and a client system with
plenty of resources, it's easy to forget that these processes take
time. The truth, however, is that each page that's fully rendered
does require a measurable amount of time, and in any process
where you need to move through a large number of pages rapidly
(such as automated testing), those increments of time can add up to
a significant delay.
No Rendering, No Problem
With headless testing, you don't need to render anything (unless you
want to specifically perform graphics-related operations, such as
capturing GUI elements in the form of screenshots or PDFs). This
allows you to perform non-GUI tests without any of the delays
associated with page rendering, speeding up and simplifying your
test regime.
Early Testing
Headless browsers are also ideal for testing features at a relatively
early stage of development, before their associated GUI components
are fully in place. This allows you to test for functional and
performance problems without having to wait for the visual elements
of the page to be put in place.
Scriptability
While it's true that most full-featured browsers can be run from the
command line, headless browsers are by nature fully scriptable; any
task which you can perform with a headless browser can be done
from the CLI or a script, making them in effect optimized for
automation.
Small-Footprint Testing
You can use low-resource containers or VMs for headless browser
testing, running automated tests in a cloud environment. This low
demand for resources makes it possible to maximize the speed,
variety, and volume of your tests. You can also use a minimal
physical machine (for example, an older system with no monitor
attached) to run automated tests in the production environment,
freeing up newer hardware for more resource-intensive tasks.
You can separate your testing tasks into those which do require a
full browser and those for which a headless browser will work, and
then design your test regime accordingly. Doing this will allow you to
make efficient use of your testing resources, maximize the number
and variety of tests that you can run, and optimize your use of the
time available for testing.