Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it necessary to write Unit tests in web development? [closed]

I have been doing web development for more than 4 years. I have worked on several different projects but we have never ever written unit tests in even a single project.

With all the tight schedules and the dead lines, it becomes really hard to write tests. So my questions are :-

  1. Is it really necessary to write the unit tests while doing web development?
  2. If yes, how does one manage his time while doing coding and testing?
  3. How does writing or not writing unit tests affect the overall quality of the web project?
  4. How much impact does it have on the overall timeline of the project?

PS:- We do web development in java, struts, spring and hibernate. JUnit is widely used for testing in java. Also, Spring and Struts have some in built support for JUnit.

Any views on this will be appreciated.

Thanks.

like image 777
ashishjmeshram Avatar asked Apr 06 '11 09:04

ashishjmeshram


2 Answers

Is it really necessary to write the unit tests while doing web development?

Yes.

If yes, how does one manage his time while doing coding and testing?

We are supposed to write test cases in the time given to finish the project. After finishing some bunch of functionalities you can start writing test cases. After these test cases are done you can go on adding new functionalities.

How does writing or not writing unit tests affect the overall quality of the web project?

While writing testcases, you will find bugs in your app which may be not seen by you. This way, writing test cases helps improving the quality of the whole project. Automated test suites also make it easy to check the project's functionalities after a new functionality is added.

How much impact does it have on the overall timeline of the project?

In some companies you can schedule writing test cases seperately. Sometimes this is even done by separate teams. In other companies the developer/tester has to manage it in between the coding and finish both the writing test cases and project within the scheduled time for the project.

like image 144
Harry Joy Avatar answered Oct 22 '22 04:10

Harry Joy


Normally in a project environment, it is testers job to write unit tests however devs cannot totally ignore it. Unit testing becomes helpful when there is extensive/complex coding involved. It is not obligatory to write unit tests however doing so will reduce the number of bugs to a great extent, because you are able catch them at the source(while unit testing) Quality of the project will definitely improve if you incorporate unit testing, simply b'coz most number of bugs are found & fixed here. Well, managing time is very crucial. If you have enough time then you can go on writing tests for all modules in the project, but if not then select only critical ones'. It is important to plan and then proceed with the development, if you were to include unit testing in your development tasks.

like image 23
Misam Avatar answered Oct 22 '22 04:10

Misam