20150909_163445

Mount Rainier as seen from Seward Park, 9/9/15

(Heads up: this post deals with a health issue of a personal nature, invoking a metaphor from my experience learning Behavior Driven Development (BDD) testing. I felt it was important to share my experience, not only with friends and family but with others, internet searchers, who might be facing something similar. If that makes you uncomfortable or seems too intimate based on our limited relationship, feel free to give this one a pass.)

In my class we’ve been studying behavior-driven development (BDD), a relative of test-driven development (TDD), which takes an approach of: let’s write tests first that describe how we want our app to behave, and then write the code to make those tests pass.

So for example, here’s a simple test excerpt for the main section of my in-progress portfolio page:

feature "CanAccessStaticPages" do
  scenario "on the index page" do
    visit "http://www.marydickson.info"
    page.must_have_content "Mary Dickson Diaz"
    page.wont_have_content "hookers and blow"
  end
end

You can program your tests to click on things and fill in information to test, say, posting a blog post, or a log-in/log-out function. “Or you could just go click on stuff and see if it’s working” –yes but writing the tests in advance, and keeping them updated, saves immense developer time and energy over time, over changes, and when coding on teams and to scale.

Continue reading