Struts2 action - check it or not?

I am currently working on one project that uses the Struts2 framework. We use a separate component to access the database, which is well tested. At the same time, the project we are working on has a lot of actions that are not verified. In most actions, we use at least one DB service call. Therefore, on the one hand, these actions are quite simple. I'm not sure - should unit tests be written for this or not?

I believe that good practice is a single recording tests, but these actions are so simple, and now I am under great pressure from the leadership. So, is it critical or not to leave Struts2 actions without unit tests?

+3
source share
3 answers

Here are three main reasons for writing unit tests.

  • This will help you understand that your code is working now.
  • This helps protect your code from regression errors when functionality is added or changed in the future.
  • If you write unit tests before writing code, it focuses your design process very well - read on TDD to learn more about the benefits of this.

So, ask yourself if any of these three reasons is applicable to writing unit tests. If the answer is no for all three questions, consider the cost of writing unit tests and storing them in a code base. Compare this value with the possible benefits. Make a smart decision about whether to write block tests, and be prepared to protect this decision from your manager.

, " ". - " ". .

+6

, Dhanji Prasanna, Guice Google Wave. 100% - , , , .

Struts2 . . struts2-junit Spring 3 IoC Struts2 . / , .

, . , .

, 100% 100% , , . , .

+1

Unit Test , , , , , , . , , , , , , .

0

All Articles