An SVN hook for checking changes has also been added to the corresponding Test class.

Does anyone come across a pre-commit SVN hook that works with the following logic?

If "MyClass.java" has been modified and committed, then a change should also be made to "MyClassTest.java" by naming convention.

The goal here is to make sure that the developer made changes to the corresponding unit test when he / she changed the piece of code.

I know this can be fooled by simply changing a bit of formatting. But the goal is not to stop cheating. It is very important to encourage test-based development in a team that is moving towards it.

The bonus would be, because when the change is just a refactor, for the hook to ignore checking if the comment has the word "REFATOR" in the comment. (after all, pure refactors must always be done by themselves)

+3
source share
1 answer

If what you want to achieve is a “forced execution” of unit testing, I suggest checking post-commit (the test is slower than the usual commit operation) if the coverage of the test has decreased for any class. even more, put this check on the Continuous Integration server.

, "" get set, . "" .

, " , ", " , ".

+1

Source: https://habr.com/ru/post/1777592/


All Articles