Home     RSSRSS

Archives: Others

Unit Testing–What to Test

October 9, 2013 by kiranbadi1991 | Comments Off on Unit Testing–What to Test | Filed in Development, Others, Quality, Testing

One of the frequent discussions I often get into with developers especially in agile projects is how to write the test case for the class or method and what should we be testing in the unit tests.

There seems to be difference in opinion among folks as what unit test case needs to cover? Or what should we be testing with unit tests?

Should we write the test for both positive and negative input values or should we write the test that shows the code is just enough working? Or should we write the test case for all the possibilities that the code is going to fail or it’s going to be used?

All of these questions seems to be perfectly valid and there isn’t a single right answers to it. However based on my experience and little bit of wisdom, I can say that if you are working with experienced veteran programmer, then probably he will suggest that we write test cases for all possibilities and if you are part of team where everyone is young or most of them are in their midlife, then probably they will not be bothered and will ask you to write tests that shows the code is working as expected. I don’t think there is anything wrong with this approach either, however I feel it’s good that more unit tests we write, better the shape of project in the downstream phases, however this needs to be done correctly and results should be obviously visible. It does not make sense that we do unit testing for every piece of code flow and there are thousands of defects logged by the QA in the later phase. This just don’t make sense economically nor from the management prospective.

So probably I will focus on areas which I feel developers need to focus in their unit testing in this post without getting themselves buried in the art of functional testing,

There are infinite number of ways the code might fail, it might fail due to environmental changes, code might fail due to data changes or it might fail due to real bug in it. All these conditions happens all the time in various environment. So it’s practically not possible to know the failure mode beforehand. However being the developer of the code, we do assume that our code will be working will be working certain fixed environment with certain fixed perquisites for it to run. So it’s always better that we do some assumption and use our time judiciously for writing tests which reflects real time behavior.

I would suggest each of the unit tests exercised on the code under test should minimum show that.

  • The output given the code is correct and it does give us expected results.
  • Extreme boundary conditions for the input values are handled correctly.
  • Error handling is done appropriately by the code.
  • Tests should exercise the performance of the code under test

Maybe in next post I will come up with proper example to show as how to prepare test cases for each of the above conditions. We need to ensure that our unit tests are lean and thin in nature and we need to test just enough code.

Technorati Tags: ,

Tags: , ,

IIS 6 and HTTP.SYS

August 7, 2013 by kiranbadi1991 | Comments Off on IIS 6 and HTTP.SYS | Filed in Development, Environment, Others

Recently someone asked me the importance of http.sys component of IIS 6 Server hosted on Windows 2003 Server. HTTP.SYS was the new addition to IIS 6 and it does some functions which was done earlier by INETINFO.EXE process of IIS 5.0. In IIS 6.0, http.sys is just a listener and in no way processes any of the requests which it gets,

So I am writing this short information about http.sys which I am aware of,

  • HTTP.Sys is more of the Listener service. Its job is listen to the incoming requests and pass it down to downstream IIS Stack.
  • HTTP.Sys often runs in Kernel Mode, which gives it an access to TCP/IP Stack and various other hardware resources of the server.
  • Since HTTP.Sys runs in Kernel Mode, it has got high priority than other threads, so jobs allocated to http.sys gets higher priority by the native OS Threads.
  • HTTP.SYS also queues the requests till application or downstream components comes back with response. Technically it queues the requests till worker process picks the request for further     processing.
  • HTTP.SYS rarely crashes due to bad code though in very rare cases you might see the crash in badly malformed requests.
  • HTTP.SYS also caches the response and can fetch the response from Memory thereby increasing the performance of the application.
  • HTTP.SYS is the component which handles the TCP connections of the IIS Server like opening and closing the connection, bandwidth throttling etc.
  • HTTP.SYS is the component which routes the requests to the appropriate application pool.
  • Errors related to HTTP.Sys are logged into the HTTP Err logs.

More information about HTTP.Sys can be found at below URL,

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a2a45c42-38bc-464c-a097-d7a202092a54.mspx?mfr=trueiF

If you are IIS Administrator, it helps to know and understand as what are the various functions done by core component of IIS. It helps to troubleshoot and fix odd bugs.

Technorati Tags: ,,

Tags: , ,

What I did in 2012

December 20, 2012 by kiranbadi1991 | 2 Comments | Filed in Others

Today I decided somehow to take some time out for writing something as what I did in 2012 and make a short note as what I missed and what I achieved.

2012 was an very exciting year and maybe the year which will go down in my life as an year where I gave up lot of things for various reasons/circumstances and an year which gave me strength and complete different perspective of  my abilities and deficiencies.

Some of the things which I did and I missed in 2012.

  • For quite some time now I was owning bunch of domains.Out of those bunch of domains,I picked one and created my own personal site.It’s a 3 page site.Its personal site and gives some  information about me.Its good that we have some internet presence.I feel everyone should have one.
  • I started believing more in chemistry than maths.I said no to someone with whom I really wanted to get associated with.Sometimes very long past forgotten tasks come up suddenly and screw all the plans.
  • I wrote lot of code.Now I know how people build applications,deal with scalability issues,how to view the problems and how to solve them in shortest time.I wrote code for image galleries,sending emails,group mails,integrating maps,captchas,building dynamic lists,generics,collections,than for all regular functionality like insert,update,delete and create with regard to UI and databases.This is only thing I am really happy about.I am sure this will come to my help at some point in my life.
  • Lot of good folks who participates regularly in Stack exchange/Code Ranch and JQuery helped me in clearing some of my chronic understanding issue with regard to the way algorithms and codes are built and written.Without them I would banged my head at least 10 times to the wall.Actually before going to them I banged my head to the wall at least 3 times with sheer frustration.I am thankful to them.We should always thank the person who points us to right direction even though at times the person flames us.
  • Probably this was year when I cried after a very long time with real pain and feelings when my Dell Vostro’s laptop hard drive crashed.I had all my code in it and I also did not have a  backup for it.This incident was one of most  valuable lession learned by me and after this incident I realized why file sharing services  companies like Google drive or Dropbox are hugely success full. Always keep a back up of the work you do and also never show this kind of emotions in front of wife,it creates misunderstanding.
  • I will never buy gadgets from Dell going forward.They make sexy and attractive laptops with cheap parts in it.Sorry to say this but that’s my experience.
  • There was nothing much exciting about my work.All regular work which I have been doing it for years.Though I found lot of performance issues, there was just one thing which I believe I need to focus on.CSS Property overriding effect on performance and user experience when we have 1000’s of lines of html/js and css code.This is interesting area of performance improvement which I believe is hugely neglected by our profession.
  • I did some research on as how IT Industry generally work,how people over here make decisions,what motivates them,how they rate people,and why they rate people like that,what can we do to improve this profession overall.Why some folks in this industry are forced to move out or forced out and where they often make mistakes.May be I will write some short notes on my observation without bias.
  • I missed my brother in law’s wedding something which I really really feel bad.
  • Then there lot of technical stuffs I attempted and experimented with regard to various front end technologies like CSS/JS and backend technologies like Tomcat,MYSQL. I know I have not written anything in recent months.I will start writing again.
  • Then as every year, I watched lot of Chinese,Hindi,French,British and American Movies.I just love watching movies first day first show.

Finally I would like to thank all my friends  and all those companies who offered me an opportunity to write/do something.I really appreciate your offer and hope that some day we might partner.Thanks everyone for your time to visit this blog and Wish you a very happy new year 2013 and merry Christmas.

Tags: