A semantic testing suite
Good point... why bother. There are some great testing suites out there already and there might not be much difference. The only difference I'm putting forward is less code and a more readable interface.
Let's take the old "calculator" example. (I'll first write these examples in CoffeeScript as it's makes Semantic Suite look even better).
Here's the example using the Jasmine testing suite:
describe "Calculator"->calculator = nullbeforeEach ->calculator =describe ".add()"->beforeEach ->calculator.left = 50calculator.right = 70calculatoraddit "will sum the 2 numbers"->expectcalculatortotaltoBe 120
Although the above example is fine and dandy, I feel I'm always repeating myself. If the test is written well enough you shouldn't need to describe everything. Here's my proposal for Semantic Suite:
"Calculator"features ->Scenario ->Given 'calculator'->When -> calculatorleft = 50And -> calculatorright = 70And -> calculatoraddThen -> expectcalculatortotaltobe 120
If you've used any testing suite with "Gherkin" syntax, or used something like "RSpec" you may notice some influence.
"Calculator"featuresScenarioGiven'calculator' return ; ;When calculatorleft = 50; ;And calculatorright = 70; ;And calculatoradd; ;Then expectcalculatortotaltobe120; ;;;
- Install Node.js
- Clone this repo.
- Create a directory somewhere to write some tests.
ss my-directory/some-test(leaving the extension off of the file name).