BDD with easyb: a 2-day class
easyb is a behavior-driven development (BDD) framework for the Java platform. By using a specification-based DSL, easyb enables executable yet readable documentation.
A disconnect between the stakeholders who define requirements and the developers who implement them has long plagued software development. In recent years, frameworks based on dynamic languages and domain-specific languages (DSLs) have tried to bridge the stakeholder-developer gap by making code read more like normal language. In this hands on course, you'll learn the ins and outs of effective validation and verification of software applications with easyb, which is a Groovy based framework for the Java platform that provides a more natural DSL that is closely attuned to stakeholders, which ultimately helps developers and stakeholders collaborate more effectively.
easyb specifications are written in Groovy and executed via a Java runner that can be invoked through a variety of mechanism. Accordingly, with easyb, software development teams can verify the behavior of anything written in Java in a more natural (and fun!) way.
Objective
To introduce Java developers to Behavior-Driven Development (BDD) with easyb.
Goals
This two day course features 16 hands-on workshops. You'll understand the benefits of collaborative stories implemented with easyb and how this framework makes collaboration easy. You'll learn how to validate applications in the style of Test Driven Development (TDD) that facilitates mocking, user acceptance testing with Selenium, database dataset management with DbUnit and even ascertaining code coverage.
Course Outline
Throughout the program, students will be challenged with lab exercises that will drive home various techniques of Behavior Driven Development with easyb along with tools and related processes. This provides an energizing and engaging learning environment. Students will verify Java code as well as web applications and leverage a bevy of tools including Selenium, DbUnit, and various mocking libraries and techniques; what’s more, students will learn how to combine these tools in an effort to create highly structured deep verification assets that exercise applications from a micro level to a macro level. Students will then be able to leverage what they will learn in this course on their respective company's applications immediately with confidence.
Companies will benefit from having more confident developers who can quickly design, construct, and maintain highly structured, testable code that will ultimately serve as executable documentation for the organization.
Most labs will leverage a form of testing as a means to validate the lesson. That is, students will be given easyb stories that are either in a pending state or failing. Through out the course of a lab, students will invoke techniques germane to the lab to ensure that the corresponding easyb stories are running in a passable state.
We will utilize Agile principles throughout. Participants will work in a pair-programming fashion to accomplish the goals of the activity. Pairs will rotate between each workshop. There are two retrospectives each day to recap activities and refine the course approach to the participant’s special needs.
Introduction to Groovy
Dive head first into Groovy's native collections, easy iteration, syntactic shortcuts and the MOP.
Stories in action I
Stories are a fundamental for conveying information; in fact, when codified into a more formal structure, stories are an excellent way to express requirements.
Stories in action II
This lab will further explore leveraging stories as a means to express requirements and more importantly a means to convey their validation.
Principles of BDD
Behavior Driven Development isn't revolutionary -- it's just an evolutionary offshoot of Test Driven Development. As you'll find, in many cases BDD is often easier to employ and certainly conveys information in a much more natural manner.
Implementing stories with easyb I
easyb binds stories and BDD into executable documentation that both the business and development can share.
Implementing stories with easyb II
This lab will further explore using easyb's domain specific language that supports simple behaviors, stories, and even narratives.
Simple mocking
Mocking is the process of isolating objects from one another. The Java landscape has myriad mocking libraries available and they're all usable within easyb.
Advanced mocking
From rolling your own mocks to leveraging 3rd party libraries, effective mocking enables a clean layer of isolation of desired objects and systems making them ultimately easier to verify.
Automating easyb
easyb can be integrated into Ant and Maven build systems and can thus be plugged into continuous integration processes giving a wide variety of stakeholders key information regarding developmental activities.
Specifications in easyb
In addition to supporting stories as a major format for application validation, easyb supports the notion of specifications, which are a means to quickly author unit-like tests without the typical ceremony associated with the xUnit paradigm.
Database testing I
Often times, stories are written using the perspective of users; thus, many stories have a user acceptance feeling to them. As such, these verifications often involve a large portion of an application, including a database. Luckily, easyb supports dealing with databases via its DbUnit plug-in.
Database testing II
Using the DbUnit plug-in for easyb requires building datasets and coordinating their population with a database via easyb fixtures. This workshop will continue leveraging stories that validate a system which requires the use of a database.
Implementing Selenium stories I
As stories often have a higher level validation feel to them, behaviors can easily make use of other tools such as Selenium. Selenium is a powerful framework for defining browser actions and executing these actions from within the context of a real browser. This workshop and the next two will leverage Selenium in concert with easyb.
Implementing Selenium stories II
This workshop will further leverage Selenium to verify a web application via stories that mimic a user experience.
Implementing Selenium stories III
Testing web applications implies a fully deployed application with a live database. This workshop will incorporate database testing as well as further Selenium techniques married with easyb.
Code coverage and easyb
easyb is just like more traditional xUnit frameworks in that it supports code coverage. In this workshop, we'll plug Cobertura into an automated build process that is capable of measuring behavior code coverage.