How can I run unit tests only for source files that have changed?

Is there a way to get ant to run unit tests only for the java classes that it creates? For example, if MyClass.java is deprecated, ant will build MyClass.class. After that, I want it to also run MyClassTest and MyClassTestSuite if they exist. It should not be based on a naming convention. I would be fine with annotations or any other method that works.

EDIT: Several people make fun of it, saying that this is a bad idea. This would be if I were planning to test without completing all of our unit tests. My main project has more than 16 thousand units of tests, which take about 20 minutes. I ran them all before registering, but it is completely impractical to run the whole package every time I change the file. Sorry, I should have provided more context.

+5
source share
7 answers

I would not recommend this approach, there are good chances for the absence of errors resulting from side effects.

+6
source

It is not so easy...

Atlassian Clover. , , .

+4

, . , , , , , , .. , , .

, , , , ? , , , .

+4

Infinitest, Eclipse ( Intellij), , :

Infinitest Website

:

+3

, ANT, - Eclipse.

Kent Beck Eclipse JUnit Max, . " , ".

JUnit Max

+3

, , , . , , , , , , , .

, . , , , , . , , , , , , .

0

, , , , . . , .

0

All Articles