Posts

Showing posts with the label TDD

8 Benefits of Unit Testing

Programming with Confidence:  unit tests increase your confidence about the code you are developing because the tests will clearly show if the changes you made caused the failure of some part of your code. This way you can fix the code, run the tests again, and if all pass, you can continue to work with the confidence that everything is still working properly. Continuous Integration of Code:  unit testing ensures that the new features developed didn’t cause side effects on the code that was already working, so you have more confidence that the new features developed are working properly and also that they did not harm other parts of the software that previously had been already checked and perhaps even validated. Better confidence on the quality of your code:  with unit testing, you are not only  supposing  that your code is working, but instead you are  sure about it , because when all your tests are passing you know that your system is behaving e...

100% CODE COVERAGE ISN’T THE GOAL

Having 100% coverage doesn't guarantee the lack of defects—it only guarantees that all of your code was executed, regardless of whether your application behaves like it should.  So rather than obsessing about code coverage, focus your attention on making sure that the tests you do write are meaningful.

More on BDD and TDD with examples, Thanks to codeproject.com

User story-  As a product owner, I would like to get an web based email program by which I can compose email on-line and can send email. TDD-  This program should send email if To address is valid. This program should send email if CC address is valid even if To address is not valid This program should send email if BCC address is valid even if CC and To address is not valid. This program should send email even if the subject line is empty. This program should send email even if the body is empty. Problem in this - T here might be some more test cases if the option stated in 1, 2 and 3 are altered. Even there might be more test cases if he considers the format of the body of the email (like plain text, rich text or HTML). If the body is HTML, then he needs to think about the HTML encoding things. BDD- Given  that a web based email module has been developed And I am accessing it with proper authentication When  I shall write sender email address i...