Tuesday, April 23, 2013

Test Driven Development - Part I - Introduction

What is Test Driven Development? 

Microsoft defines Test Driven Development as "Test-driven development (TDD) is an advanced technique of using automated unit tests to drive the design of software and force decoupling of dependencies. The result of using this practice is a comprehensive suite of unit tests that can be run at any time to provide feedback that the software is still working. This technique is heavily emphasized by those using Agile development methodologies".

So from the definition  it is clear that TDD is based on automated unit tests. To continue with TDD we have to know Unit Testing. Before going deep into the Unit Testing , we will look into the concept of TDD little more...

The principle of Test Driven Development is Red => Green => Refactor.




In the above figure, the development or the coding is start by writing the unit tests. It fails for the first time as there is no code to compile. It fails for the second time also because of lack of logic specified in the unit test. Whenever a test fails, the unit testing framework will indicate it by the Red signal. And when the test passes it will be indicated by the Green signal. That is why Red => Green => Refactor becomes the mantra of Test driven development.

What is Unit Testing?

A unit test is an automated piece of code that invokes the method or class being tested and then checks some assumptions about the logical behavior of that method or class. A unit test is almost always written using a unit-testing framework. It can be written easily and runs quickly. It’s fully automated, trustworthy, readable, and maintainable.

A good unit test should have the following properties

  • It should be easy to implement.
  • It should be automated and repeatable.
  • Once it’s written, it should remain for future use.
  • Anyone should be able to run it.
  • It should run at the push of a button.
  • It should run quickly.

Thursday, December 27, 2012

history.back() not working in chrome

I have faced this issue and searched for long time to get a good solution. Instead of using history.back(), use history.go(-1). It is working in IE,Chrome and Firefox. Add return false also to the function


example:
 <html>  
 <head>  
 <script>  
 function goBack()  
 {  
   window.history.go(-1);  
   return false;  
  }  
 </script>  
 </head>  
 <body>  
    <input type="button" value="Back" onclick="goBack()">  
 </body>  
 </html>  

Tuesday, August 21, 2012

Could not create 'CDO.Message' - The transport failed to connect to the server


This is an SMTP Server error. There are so many reasons for getting this error.  So you have to check the Inner Exception of this exception. One of the inner exception for this error is "The transport failed to connect to the server". If you found this error initially check the Firewall setting. The firewall might block the web mail port. Add firewall exception to the web mail port (25) .

And instead of assigning the server like
SmtpMail.SmtpServer = "127.0.0.1 or your mail server name"


Use the insert method as below
SmtpMail.SmtpServer.Insert( 0, "127.0.0.1 or your mail server name")


Some more details are available at Microsoft Support

Thursday, July 12, 2012

Could not find stored procedure 'sp_sdidebug'

This error comes in Visual Studio due the Project property settings. It comes during the debug session. The SQL Server debugging  option in the Project properties should be Turned Off before starting the debug.


Thursday, July 5, 2012

How to remove the Header and Footer added by the browser for HTML Print

There is no way to remove the header and footer added  by the browser through javascript code.  The user has the option to change the page setup before making the print out.  The below site nicely explains how to change the page setup for 1E,FireFox and Opera.
http://www.mintprintables.com/print-tips/header-footer-windows/

But it is not telling about the Chrome.

The new version of Chrome (20.0.1132.47) has an option to remove the header and footer. See the below image.


Monday, July 2, 2012

How to convert LogmeIn-Pro to LogmeIn-Free

It will be converted automatically when the trial version get expired. No other changes required. It will disable the Pro features also like Dashboards, File Sharing , Chat etc.