skip to main | skip to sidebar

Blog Edan

  • Entries (RSS)
  • Comments (RSS)
  • Home

Rabu, 02 Mei 2012

[html5apps] Fw: Learned a lot about BDD today, but?

Diposting oleh Den TOMJERRX di 5/02/2012 02:33:00 PM
 

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

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

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
_______________________________________________________________________________


__._,_.___
Reply to sender | Reply to group | Reply via web post | Start a New Topic
Messages in this topic (1)
Recent Activity:
  • New Members 1
Visit Your Group
Yahoo! Groups
Switch to: Text-Only, Daily Digest • Unsubscribe • Terms of Use
.

__,_._,___
Kirimkan Ini lewat Email BlogThis! Bagikan ke X Berbagi ke Facebook

0 komentar:

Posting Komentar

Posting Lebih Baru Posting Lama Beranda
Langganan: Posting Komentar (Atom)

Labels

  • ping script (1)
  • Url Submiter (1)

Blog Archive

Total Tayangan Halaman

Our Partners

All About Tutorial
Free link exchange All Content Let's Cheat The Games Free Backlink Rea Soft Free Domain Name

Archive

Meta Tag Analyser

Translator

blogger widgets

Referrer Link

www.e-referrer.com

 

© 2010 Blog Edan
designed by Wong Edan - All About Tutorial