http://en.wikipedia.org/wiki/Behavior_Driven_Development
http://inter-sections.net/2007/10/03/the-difference-between-tdd-and-bdd
However, to be honest I still do not completely understand (
Anyway I proceeded forward and best tools for BDD are Node.js modules Mocha and Should:
http://visionmedia.github.com/mocha/
(I read the documentation very carefully).
Then moved over to Should:
https://github.com/visionmedia/should.js#readme
At this point I started playing with Mocha, and was not able to run it. After about 3-4 hours I set the path to F:\myproject\node_modules\.bin and started running, then I created directroy test in my myproject directory i.e. F:\myproject\test
and wrote this in my myfirsttest.js file
/**
* Created with JetBrains WebStorm.
* User: zia
* Date: 4/27/12
* Time: 8:02 PM
* To change this template use File | Settings | File Templates.
*/
//http://visionmedia.github.com/mocha/
//http://dailyjs.com/2011/12/08/mocha/
//https://github.com/visionmedia/should.js#readme
//http://www.adomokos.com/2012/01/javascript-testing-with-mocha.html
//http://stackoverflow.com/questions/9779700/mocha-requires-make-cant-find-a-make-exe-that-works-on-windows
//http://en.wikipedia.org/wiki/Behavior_Driven_Development
//http://inter-sections.net/2007/10/03/the-difference-between-tdd-and-bdd
var should = require('should');
var panacloud = require('./../panacloud');
describe('Panacloud Registration', function(){
before(function(done){
panacloud.cleanDatabaseAsync().then(function(msg){
done();
},
function(errMsg){
done();
});
});
describe('#isRegistrationAsync()', function(){
it('should not be registered', function(done){
panacloud.isRegisteredAsync("11").then(function(data){
//should.equal(data.isRegistered, false, "Not registered as it should be");
data.isRegistered.should.be.false;
// Tell Mocha the test has finished
done();
});
})
})
})
And it is working but I still donot understand the theory behind BDD, I understand these tests are very easy to read even for the end user but don't understand the complete theory behind it. Also I am very tired. I think it will come to me in time, or may be you can tell me?
_______________________________________________________________________________
Zia Khan
Become my friend on Facebook: http://www.facebook.com/ziakhan
Mobile: 92-300-826-3374 (Pakistan)
Microsoft's Windows Azure Discussion Group: 3,000+ Members
CFA, CPA, and CMA Exam Preparation Discussion Group: 3,700+ Members
_______________________________________________________________________________

0 komentar:
Posting Komentar