Ruby on Rails and Verification

I’ve spent the last few months learning Ruby and using Rails.  Ruby is a dynamic, interpreted language with introspection and a rich syntax for expressing things concisely.  Rails is a web-framework that helps people create industrial-strength web sites.   Both the language and the framework are developed-by and developed-for programmers.  I am very comfortable in this environment!


In a previous life, I worked in Logic Verification for semiconductors.  In the mainstream and over the last decade, Verification evolved from a process in which engineers used simulators to look at waveforms, to self-checking test-benches, to test-generators using randomness to sample a space of possible device behaviors.  It’s interesting to notice how the Rails community has embraced “tests” and “specs” as a fundamental part of the development process.  Good Ruby programmers check-in code with accompanying unit-tests.  And because Ruby has standard packages to express these tests, it is pretty easy to do.  Standard Rails packages extend these ideas to the testing of web sites.  Here, “controller tests” correspond roughly to  “block-level” verification, and “integration tests” correspond rougly to “system-level” verification.

There are other similarities.  The “stimulus” of a logic test is roughly an “HTTP Request” and instead of a “simulator” we’re testing a “web-server.”  Logic “responses” are “web-pages.”  Here is where the comparisons end, however.  Most Web 2.0 web-pages have Javascript in them, and thus the response itself is executable.

In some ways the Rails community is way ahead of the Logic Verification community.  Mutations as a way of debugging the test-bench are standard add-ons to Rails.  Cucumber lets Rails developers write specifications in a high-level language — much clearer than anything I saw in Logic.  The ideas of constrained-random-testing have not yet been embraced in the Rails world, as far as I can tell.  But since there’s a Gem for almost everything in Ruby, I wouldn’t be surprised to see it soon.

Leave a Reply

Your email address will not be published. Required fields are marked *