Java Reference
In-Depth Information
Table 4.1
Testing how objects, services, and subsystems interact
Interaction
Test description
Objects
The test instantiates objects and calls methods on these objects.
Services
The test runs while a servlet or EJB container hosts the application, which may
connect to a database or attach to any other external resource or device.
Subsystems
A layered application may have a front end to handle the presentation and a
back end to execute the business logic. Tests can verify that a request
passes through the front end and returns an appropriate response from the
back end.
you write application code. Being able to code to the test dramatically increases a pro-
grammer's ability to write well-behaved objects.
F UNCTIONAL SOFTWARE TESTING
Functional tests examine the code at the boundary of its public API . In general, this
corresponds to testing application use cases.
Developers often combine functional tests with integration tests. For example, a
web application contains a secure web page that only authorized clients can access.
If the client doesn't log in, then trying to access the page should result in a redirect
to the login page. A functional unit test can examine this case by sending an HTTP
request to the page to verify that a redirect ( HTTP status code 302) response code
comes back.
Depending on the application, you can use several types of functional tests, as
shown in table 4.2.
Table 4.2
Testing frameworks, GUIs, and subsystems
Application type
Functional test description
The application uses a
framework.
Functional testing within a framework focuses on testing the frame-
work API (from the point of view of end users or service providers).
The application has a GUI.
Functional testing of a GUI verifies that all features can be accessed
and provide expected results. The tests access the GUI directly,
which may in turn call several other components or a back end.
The application is made up
of subsystems.
A layered system tries to separate systems by roles. There may be a
presentation subsystem, a business logic subsystem, and a data
subsystem. Layering provides flexibility and the ability to access the
back end with several different front ends. Each layer defines an API
for other layers to use. Functional tests verify that the API contract
is enforced.
S TRESS TESTING
How well will the application perform when many people are using it at once? Most
stress tests examine whether the application can process a large number of requests
 
 
Search WWH ::




Custom Search