formats (for example, based on HTML
or Microsoft Excel), and the program
writes the results after running the tests
against the system under test.
Describing requirements in an executable way fosters the barrier-free
approach. Merging different documentation mediums (single-sourcing product information) reduces the amount of
traditional documentation, because the
specification is the system’s functional
documentation and, therefore, can be
efficiently validated against the current
software state. This leads to living documentation that is always up to date.
tools to write acceptance tests, or you
can use specialized languages. Scala
and Groovy, both first-class citizens on
the Java Virtual Machine (JVM), offer
interesting features for setting up a
polyglot ecosystem and leveraging existing platforms by providing solutions
that involve special-purpose languages.
With Scala and Groovy, you can write
tests, which helps to overcome
■ ■ Barriers between project phases and
project activities (because coding and
testing move together more closely)
■ ■ Barriers between artifact types
(because code and executable specifications are written on the same unified infrastructure)
■ ■ Barriers between project roles
(because tests are written collaboratively, with mechanisms to use terms
close to the problem domain)
■ ■ Barriers between tools (because the
same tools are used for programming
and testing)
Overcoming common project barriers
leads to what I call a barrier-free
approach. The example shown in
Listing 1 gives you an impression of
what it can look like to write BDD-flavored acceptance tests with Scala
and the Scala specs2 library.
The code in Listing 1 integrates the
Web application test system, Selenium2,
to smoke test the HotBot Web search.
The defined is method lists specification fragments that can be simple text
(a description of the target system) or an
example (including executable code that
returns a result). Fragments are separated and linked by the ^ character.
package alm
import org.specs2._
import matcher. ThrownExpectations
import specification.Step
import Thread._
import org.openqa.selenium. WebDriverBackedSelenium
class Selenium2 extends Specification with ThrownExpectations {
lazy val selenium = new WebDriverBackedSelenium(new org.openqa.selenium.
firefox.FirefoxDriver(), " http://www.hotbot.com/")
JAVA IN ACTION
Behavior-Driven Development
Behavior-driven development (BDD)
promotes a special approach to writing
and applying acceptance tests that is
different from the traditional test-driven
development (TDD), although BDD also
promotes writing tests first.
With BDD, tests are like functional
specification stories, normally in a
“given/when/then” format. This
specification-oriented technique also
uses a natural lan-
guage to ensure
cross-functional com-
munication and to
ensure that business
concepts are under-
stood. BDD provides a
ubiquitous language
for analysis and em-
phasizes application
behavior over testing.
You can use dedicated, lightweight
def is =
sequential
"This specification smoke tests HotBot search" ^
Step(() => selenium)
"Enter search token and check the title of the SERP" acc^
Step( selenium.stop())
end
def acc = {
import selenium._
open("/")
`type`("search-Input", "Agile ALM")
click("search-Submit")
get Title() must start With("Agile ALM")
}
}
ABOUT US
See listing as text
Agile ALM
improves product
quality, reduces
time to market,
and makes
for happier
developers.
Summary
Agile ALM provides more structure for ag-
ile software development and helps you
approach ALM in a determined, pragmat-
ic way. Using an agile approach to ALM
can increase productivity and enhance
results. Streamlining Java development
with agile ALM integrates various prac-
tices (such as continuous integration and
writing acceptance tests collaboratively),
languages, and tools to improve software
development practices. </article>
LEARN MORE
•;Agile ALM (Manning Publications, 2011)
•;A Guide to Software Configuration
Management (Artech House, 2000)
•;Configuration Management Principles
and Practice (Addison-Wesley, 2003)
blog