At 1.build, the goals is:
Cobertura:cobertura
2. After running, you can see the HTML file below the site
3. Operation Record:
[INFO] Scanning for projects ... [INFO] [INFO]------------------------------------------------------------------------[INFO] Building mavenlearning 0.0.1 -snapshot[info]------------------------------------------------------------------------[INFO] [INFO] >> > Cobertura-maven-plugin:2.7:cobertura (DEFAULT-CLI) > [cobertura]test @ mavenlearning >>>[info] [INFO] ---maven-resources-plugin:2.6:resources (default-resources) @ mavenlearning---[INFO] Using ' UTF-8 ' Encoding to copy fil tered resources. [INFO] Skip non existing resourcedirectory d:\all\eclipse432\mavenlearning\src\main\resources[info] [INFO]--- Maven-compiler-plugin:3.1:compile (default-compile) @ mavenlearning---[INFO] nothing to Compile-all classes is up to D Ate[info] [INFO]---cobertura-maven-plugin:2.7:instrument (default-cli) @ mavenlearning---[info] cobertura 2.1.1-gnu G PL License (NO WARRANTY)-see COPYRIGHT File[info] Cobertura:loaded information on 1 classes. [INFO] Cobertura:saved information on 1 classes. [INFO] Cobertura:saved information on 1 classes. [INFO] Instrumentation was successful. [INFO] Not adding Cobertura ser file to attached artifacts list. [INFO] [INFO]---maven-resources-plugin:2.6:testresources (default-testresources) @ mavenlearning---[info] Using ' UTF-8 ' Encoding to copy filtered resources. [INFO] Skip non existing resourcedirectory d:\all\eclipse432\mavenlearning\src\test\resources[info] [INFO]--- Maven-compiler-plugin:3.1:testcompile (default-testcompile) @ mavenlearning---[INFO] changes detected-recompiling The module! [INFO] Compiling 4 source files to D:\all\eclipse432\mavenlearning\target\test-classes[info] [INFO]---maven-surefire-plugin : 2.12.4:test (default-test) @ mavenlearning---[INFO] Surefire report directory:d:\all\eclipse432\mavenlearning\ Target\surefire-reports-------------------------------------------------------t E S t S-------------------------------------------------------Running org.xubo.maven.MavenLearning.AppTestTests run:1, failures:0, errors:0, skipped:0, Time ELA psed:0.042 secrunning org.xubo.maven.MavenLearning.CopyOfHelloWorldTestTests run:1, failures:0, Errors:1, skipped:0, Time elapsed:0.009 sec <<< Failure!initializationerror (org.xubo.maven.MavenLearning.CopyOfHelloWorldTest) Time elapsed:0.009 sec <<< Error!java.lang.exception:method Testhello () should be Publicat ORG.JUNIT.RUNNERS.M Odel. Frameworkmethod.validatepublicvoid (frameworkmethod.java:88) at ORG.JUNIT.RUNNERS.MODEL.FRAMEWORKMETHOD.VALIDATEPUBLICVOIDNOARG (frameworkmethod.java:66) at Org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods (parentrunner.java:122) at Org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods (blockjunit4classrunner.java:193) at Org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods (blockjunit4classrunner.java:168) at Org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors (Blockjunit4classrunner.java:115) at Org.junit.runners.ParentRunner.validate (parentrunner.java:269) at Org.junit.runners.parentrunner.<init> (parentrunner.java:66) at Org.junit.runners.BlockJUnit4ClassRunner. <init> (blockjunit4classrunner.java:59) at Org.junit.internal.builders.JUnit4Builder.runnerForClass ( JUNIT4BUILDER.JAVA:13) at Org.junit.runners.model.RunnerBuilder.safeRunnerForClass (runnerbuilder.java:57) at Org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass (Alldefaultpossibilitiesbuilder.java :) at Org.junit.runners.model.RunnerBuilder.safeRunnerForClass (runnerbuilder.java:57) at Org.junit.internal.requests.ClassRequest.getRunner (classrequest.java:24) at Org.apache.maven.surefire.junit4.JUnit4Provider.execute (junit4provider.java:250) at Org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet (junit4provider.java:141) at Org.apache.maven.surefire.junit4.JUnit4Provider.invoke (junit4provider.java:112) at SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native Method) AT Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (method.java:606) at Org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray (reflectionutils.java:189) at Org.apache.maven.surefire.booter.providerfactory$providerproxy.invoke (providerfactory.java:165) at Org.apache.maven.surefire.booter.ProviderFactory.invokeProvider (providerfactory.java:85) at Org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess (forkedbooter.java:115) at Org.apache.maven.surefire.booter.ForkedBooter.main (forkedbooter.java:75) Running Org.xubo.maven.MavenLearning.TestHelloWorldTests Run:1, failures:0, Errors:1, skipped:0, time elapsed:0.021 sec <& lt;< Failure!initializationerror (Org.xubo.maven.MavenLearning.TestHelloWorld) Time elapsed:0.021 sec << < Error!java.lang.exception:method Testhello () should be Publicat Org.junit.runnerS.model.frameworkmethod.validatepublicvoid (frameworkmethod.java:88) at ORG.JUNIT.RUNNERS.MODEL.FRAMEWORKMETHOD.VALIDATEPUBLICVOIDNOARG (frameworkmethod.java:66) at Org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods (parentrunner.java:122) at Org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods (blockjunit4classrunner.java:193) at Org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods (blockjunit4classrunner.java:168) at Org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors (blockjunit4classrunner.java:115) at Org.junit.runners.ParentRunner.validate (parentrunner.java:269) at org.junit.runners.parentrunner.<init> ( parentrunner.java:66) at org.junit.runners.blockjunit4classrunner.<init> (blockjunit4classrunner.java:59) at Org.junit.internal.builders.JUnit4Builder.runnerForClass (junit4builder.java:13) at Org.junit.runners.model.RunnerBuilder.safeRunnerForClass (runnerbuilder.java:57) at Org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerFoRclass (alldefaultpossibilitiesbuilder.java:29) at Org.junit.runners.model.RunnerBuilder.safeRunnerForClass ( runnerbuilder.java:57) at Org.junit.internal.requests.ClassRequest.getRunner (classrequest.java:24) at Org.apache.maven.surefire.junit4.JUnit4Provider.execute (junit4provider.java:250) at Org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet (junit4provider.java:141) at Org.apache.maven.surefire.junit4.JUnit4Provider.invoke (junit4provider.java:112) at SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke ( nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke ( delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (method.java:606) at Org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray (reflectionutils.java:189) at Org.apache.maven.surefire.booter.providerfactory$providerproxy.invoke (providerfactory.java:165) at Org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(providerfactory.java:85) at Org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess (Forkedbooter.java : Org.apache.maven.surefire.booter.ForkedBooter.main (forkedbooter.java:75) results:tests in error: Initializationerror (org.xubo.maven.MavenLearning.CopyOfHelloWorldTest): Method Testhello () should is public Initializationerror (Org.xubo.maven.MavenLearning.TestHelloWorld): Method Testhello () should be publictests Run:3, failures:0, Errors:2, Skipped:0[error] there is test failures. Refer to D:\all\eclipse432\MavenLearning\target\surefire-reports for the individual test results. [INFO] [INFO] <<< Cobertura-maven-plugin:2.7:cobertura (DEFAULT-CLI) < [cobertura]test @ mavenlearning << <[info] [INFO]---cobertura-maven-plugin:2.7:cobertura (default-cli) @ mavenlearning---[info] cobertura 2.1.1-gnu G PL License (NO WARRANTY)-see COPYRIGHT File[info] cobertura:loaded information on 1 classes. Report Time:103ms[info] Cobertura report GeneratIon was successful. [INFO]------------------------------------------------------------------------[INFO] BUILD Success[info]-------- ----------------------------------------------------------------[INFO] Total time:5.397 s[info] finished at: 2016-05-10t17:10:55+08:00[info] Final Memory:24m/166m[info]----------------------------------------------------- -------------------
4.pom:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >< Modelversion>4.0.0</modelversion><groupid>org.xubo.maven</groupid><artifactid> mavenlearning</artifactid><version>0.0.1-snapshot</version><packaging>jar</ packaging><name>mavenlearning</name><url>http://maven.apache.org</url>< Properties><project.build.sourceencoding>utf-8</project.build.sourceencoding><junit.version >4.11</junit.version></properties><dependencies><dependency><groupid>junit </groupId><artifactId>junit</artifactId><version>4.8.1</version><scope> Test</scope></dependency><dependency><groupid>log4j</groupid><artifactid> Log4j</artifactid><version>1.2.17</version><scope>compile</scope></dependency></dependencies><!--<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId> maven-surefire-plugin</artifactid> <version>2.18.1</version> </plugin> </plugins> </build>--></project>
MAVEN Learning 13 Coverage test