BDD FOR LEGACY SYSTEM Spin Lai
Testing
Unit test
Tests the smallest unit of functionality
Integration test
Test the result combination functions correctly.
Acceptance test
Tests on the full system to see whether the application's functionality satisfies the specification
Testing
TDD (Test-driven Development)
BDD (Behavior-driven Development)
FDD (Feature-driven Development)
MDD (Model-driven Development)
DDD (Domain-driven Design)
Behavior-driven Development
A software development process
Emerged from TDD
Focus on “what” to test rather than “how” to test
Use examples to illustrate behavior
Writing test cases in a natural language that non-programmers can read
Using Domain Specific Language
Why BDD ?
Executable specifications
Business needs tie directly to the code
Tests are easier to maintain (stable)
Why BDD ?
Provides a common domain language for
User / Stakeholder
Project Manager
Developer
QA
Encourage collaboration between different roles
Legacy System
It wasn’t designed with automation in mind
Web elements with no identifier or meaningful classes
Limited control of the source code
Works, but hard to maintain
BDD for legacy system
Think about the capabilities
Group the scenarios
What kind of contexts (the Givens)
What kind of outcomes (the Thens)
The events (the Whens)
Selenium
Automated web testing framework
Selenium IDE
Selenium Remote Control
Selenium Client API
Selenium WebDriver
Selenium Practices
UI Mapping
Page Object design pattern
Three levels of UI test automation
Source : http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/
PyHamcrest
Assertion matcher library
Predefined matchers
equal_to
has_properties
contains_string
ends_with
…
Recap
BDD isn’t the only way to do testing
Use BDD tools to automate scenarios doesn’t means you’re doing BDD
Don’t start with tools, start by having conversations
Don’t stick to the BDD (Gherkin) format to have conversations