This is good, THANK YOU.
Zia
From: Zafar Hussain Luni
Sent: Wednesday, May 02, 2012 12:22 PM
To: Zia Khan
Subject: Re: Learned a lot about BDD today, but?
Don't know whether it will help or not but I can share some little understanding of TDD and BDD with you.
At core level BDD and TDD are same. They are used for testing your code. But with different vocabulary and semantics.
I make my understanding clear by calling BDD a "Specification driven development" or "Scenario driven development". In TDD we write arbitrary unit test of pieces of our code. They have meaning at atomic level but the don't represent any scenario or specification. For example in TDD unit tests can be like
check_user_info_not_empty
check_if_user_exists
create_user
find_user
but in BDD we create a Scenario like
Scenario: User Registration
For_Registration_user -> Should -> have given all data required
-> there should not be already other user with same name -> then -> create user
In BDD we write scenario related to a requirement/specification. And it very easy to understand requirement with help of test cases. So in BDD we are actually directly mapping requirement scenarios/use cases with tests.
You can have a look at Cucumber which is an excellent BDD framework. It will help you a lot in developing your understanding related to BDD by looking at its examples.
Regards,
Zafar Hussain Luni
Zafar Hussain Luni
From: Zia Khan <ziaukhan@hotmail.com>
To: Zia Khan <ziakhan@gmail.com>
Sent: Monday, April 30, 2012 10:28 PM
Subject: Learned a lot about BDD today, but?
As you know software without tests is useless therefore I started this morning with a wish to write some tests for my project. I came across a new word which I did not understand: BDD. I knew about TDD but not BDD (. Read these pages:
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
var should = require('should');
var panacloud = require('./../panacloud');
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/
* 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
//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
//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();
});
});
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();
});
})
})
})
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
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
_______________________________________________________________________________
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