This is mainly Lee's fault. I had quietly descended into the corporate monotony of coffee and flourescent lights, without any of this open technology community stuff. But he said he might blog every day which made me feel slightly insecure about my technical credentials, so I've decided to do the same, in order to keep papering over the cracks in my professional veneer.
Today, I yearn for inconclusiveness. We've wrapped a little bit of code around the qunit test harness in order to do some more BDD-ish stuff. Such as:
1: var Given_I_have_already_tried_to_checkout = function () {2: SpecBase.call(this);3: Given_three_items_have_been_added_to_the_basket.call(this);4: Given_fake_baskets_serive.call(this);5:6: this.basket = gbL.Cart.getInstance();7:8: // Given this is not the first checkout9: this.protect(this.basket);10: this.given(function() {11: this.basket.isFirstCheckout = function() { return false; };12: });13: };14:15: test("When I try to checkout again", function() {16:17: this.when(function() {18: this.actual = this.basket.checkout();19: });20:21: this.then(function() {22: ok(this.actual, "it should complete without error");23: });24: });25:34:
As you can see it’s a fairly simple given, when, then structure wrapped around the qunit TDD framework. This gets executed on TeamCity using JsTestDriver.
The problem is, as I’m doing BDD instead of TDD, the natural inclination is to go ahead and spec out all the behaviours ahead of time, which means I end up with a bunch of red “tests” in the build server. As far as I can see, QUnit doesn’t have a “ignore this” or “inconclusive” assertion built-in.
What I want to do is something like:
15: test("When I try to checkout again", function() {16:. . .25:26: this.then(function() {27: var putCall = this.fakePUT.getCall(0);28: var callsTheRightService = putCall.args[0] == "/baskets/knownUUID";29:30: // TODO: determine correct atom content format31: // var usesTheRightFormat = putCall.args[1] == ?32:33: inconclusive("it should send the updated basket to the server");34:35: });36:37: });21:
Which should give me a nice orange bar in the qunit interface, and would probably show up as an ignored test in TeamCity.
Well there you go. I yearn for it. Like as the hart pants for the water. Perhaps tomorrow I’ll pick up my open source spiritual armour and fix it.
No comments:
Post a Comment