Andrew Oberstar

Unit Testing Legislation

January 12, 2012

Just think how cool it would be if you could run unit tests on legislation...

I was just reading through the Wikipedia page on SOPA (the Stop Online Piracy Act), with people going back and forth about whether the bill's language does or does not permit certain activity. I'm misusing the term unit testing, but the idea of running automated tests against legislation to verify that it fulfills it's intended purpose is very appealing. It's inherently difficult (more likely impossible) given the way that law works (not that I understand it), but just go with me for a minute. Imagine if you could write (and run) something like this (yay for Spock against SOPA:

class SopaTest extends Specification {
    Sopa sopa = new Sopa()

    def 'sopa stops foreign sites dedicated to piracy'() {
        Site site = new PiracyRUs()
        Person ownerOfSite = new Pirate()

    def 'sopa does not shutdown youtube'() {
        Site site = new Youtube()
        Person userA = new OrdinaryPerson()

Run that and find out if SOPA really does violate our First Amendment rights or not. Just think how easy life could be then.

Recent Posts