Beruflich Dokumente
Kultur Dokumente
g
z
MANAGE
2
There are four ways to go about the business of integration testing. One is the wrong
way; the other three are...
u
c
c Sign in for existing members
n
1 Continue Reading
2
By submitting your personal information, you agree that TechTarget and its partners may contact you
regarding relevant content, products and special offers.
You also agree that your personal information may be transferred and processed in the United States, and
that you have read and agree to the Terms of Use and the Privacy Policy.
much more interesting.
"I use the term integration test to mean any test whose result (pass or fail) depends
on the correctness of the implementation of more than one piece of non-trivial
behavior."
The problems come when we treat integration tests as if they were unit tests: with
their only value being to the programmer; running them in conjunction with every
build; managing them as if they were unit tests; under such circumstances the value
of the integration tests will be minimal, and the cost of them very high.
But there are valuable approaches to creating and managing integration testing.
What Mr. Rainsberger's description of a typical approach to integration testing lacks
is a sense of purpose, a heuristic that guides the integration tester to choose
appropriate tests. With such heuristics in place, integration testing can be quite
valuable.
1API testing
More and more we see applications exposing an Application Programming Interface,
or API. An API is most often public; it allows outside parties the ability to control
some part of the application from those parties' own programs. For example, you can
write a program that will use the Twitter search API to search Twitter for posts
containing some phrase of interest; when you get the results, you can update a page
on a wiki with the content from Twitter via the API for the wiki.
PRO+ E-
E -H
Han
and
dboo
bookk
eh
e ha
annd
dboo
bookk_c
_cove
overr
API testing is a valid and valuable approach to integration testing. An API allows
users to write a program to achieve some sort of business function: retrieve data,
update information, monitor status, etc. Since APIs are not used by human beings,
any changes to an existing API has the potential to wreak havoc among those using
that aspect of the API. Since business functions tend to exercise significant portions
of the code base at once, it behooves the supplier of an API to have robust
regression tests; not for random combinations of classes in the code base, but
instead tests to validate each business function exposed in the API. These business
functions must continue to operate correctly as the API is maintained and expanded.
Development, or ATDD. With ATDD, before writing any code, the business will define
a set of examples that the code is intended to implement. A simple example would
be something like:
Then the object for the developer is to make that business-facing example pass,
while using unit tests appropriately in the process. Of course, ATDD can become
quite complex very quickly:
Tests that navigate the user interface are valuable because such tests expose
inadvertent errors in parts of the code base that are *not* under scrutiny by the test
itself. For example a user might wish to see a record on the third page of a long list
of records. Every other kind of test will assert that the record exists in the proper
place in a list of records; only a UI test will show us that the "Next" button is broken.
Since integration tests are highly decoupled from the actual code itself, it makes
sense to run integration tests outside of normal Continuous Integration (CI)
processes. The public APIs, the business-logic fixtures, and the UI should change
rarely, regardless of the state of the underlying code base. For this reason it makes
sense to have dedicated test runners for such tests, and separate status reporting
procedures as well. Re-factoring the code base should not cause integration test
failures. At the same time, there may be legitimate failures of the integration tests
even if the unit tests all pass. Coupling the running of the integration tests to state of
the code base is a poor practice. Instead, treat integration tests as a source of
information apart from the normal CI process.
Instead, consider adding different styles of tests to the regression test suite. If the
behavior to be tested is exposed in an API, test it there. If the behavior to be tested is
important to the business, work with the customers to implement some reasonable
acceptance tests. If the behavior to be tested has to do with how a user interacts
with the application, add some judicious UI tests.
m Next Steps
Automating the API code generation process
2 2
Testing APIs protects Explore integration testing
applications and reputations tools and services
Load More
Add My Comment
Oldest 5
Too many people think integration tests are about tying everything together, but they offer
little value when used in an end to end situation. An integration test, would more than likely
look like a call to an API to generate a token for access, and then using that token to see if it
can access the service, assert on some attribute and return.
Reply
The article speaks of the purpose but doesn't speak of the risks. Risk assessment is the tool
testing should use to prioritize the activities and turn infinite number of tests to reasonable.
Reply
-ADS BY GOOGLE
MICROSERVICES
A
2 Managing APIs for
microservices: Why it
matters and how to do it
JAVA
Microservices add their own unique set of
challenges when it comes to managing APIs.
CLOUD APPLICATIONS Twain Taylor takes a look at how ...
AWS