Wednesday, July 16, 2014

Day 48: Rails TDD (Rspec, Capybara, and Selenium)

Now I'm getting into the meat of what Test-Driven Development is all about. It's really about making sure that everything that you intend your program to do is done properly. Although it's initially slower to make these tests, in the long run you run into much less debugging issues and is better in the long run.

Here's a quick snapshot of my code for testing.



What my Selenium code is actually doing is actually visiting the intended external site and doing whatever I tell it to do. In this example I'm telling the code to put in information in the email and password input fields and click submit.

The crazy part is that it does the whole thing right in front of my eyes. The code literally opened up my Firefox Browser, filled-in the proper input fields and clicked "log in"



It's quite amazing how sophisticated these tests are capable of. It'll probably take me another half of a day to solidify this. Once that is done, I'll be learning deployment to make this Ruby on Rails stack full circle.

No comments:

Post a Comment