Using maven and jenkins, how to test programmers did some test cases?

I work on several projects and we use Java, Springs, Maven and Jenkins for CI, but I am having problems that some of the programmers do not add real junit test cases to the projects. I want maven and jenkins to run the test before deploying it to the server. Some of the programmers did an empty test, so it starts and stops and passes the tests.

Can someone please tell me how I can automate this check, so maven and jenkins can see if the test is testing some result.

+5
source share
5 answers

, .

, -

, . , , .

, "" , , , , .

, "" :

  • smokes. , try { ... } catch (Throwable t) {/* ignore */}. , .

  • , , , widgetsTurnRedWhenFlangeIsOff, widgetsCounterrotateIfFangeGreaterThan50. , , CI .

- "".

, .

Update

. , "" , , , , , , .

, . , , ""

, "JestingClassLoader", , . ASM, - "" . . , "" . , . , . , , , , "" , , , . , .

, - "" , "".

, . , , , , , . , , , " ". Google Page Rank, , , , , ( - , "" , , , , , , )

+4

Sonar, build breaker.

" metrics, , , , java

  • " " > 1
  • "" > 20

1 unit test, 20% . ( , , !)

, , Maven. Jenkins Sonar - , . Jacoco - , Sonar , Checkstyle, PMD Findbugs.

, . Sonar , .

+2

, JaCoCo, EMMA, Cobertura . ( ", " ), , . , . , , ( CI) .

+1

, , . .

, .

, , , . , , "", , , , .

+1

http://pitest.org/ " ":

Errors (or mutations) are automatically seeded in your code, then your tests are performed. If your tests fail, the mutation is killed, if your tests pass, then the mutation is alive.

The quality of your tests can be estimated from the percentage of killed mutations.

Good thing you can use it in combination with maven, jenkins and ... SonarQube !

+1
source

All Articles