maven - Get Code Coverage for GWT project using Jacoco surefire -
i having gwt maven project , want find code coverage. getting report coverage 0%.
pom.xml
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>gwt-maven-plugin</artifactid> <version>2.7.0</version> <executions> <execution> <configuration> <extrajvmargs>-xmx512m</extrajvmargs> </configuration> <goals> <goal>compile</goal> <goal>generateasync</goal> <goal>test</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactid>maven-surefire-plugin</artifactid> <version>2.6</version> <configuration> <argline>${jacocoargs}</argline> </configuration> </plugin> <plugin> <groupid>org.jboss.errai</groupid> <artifactid>jacoco-gwt-maven-plugin</artifactid> <version>0.5.4.201202141554</version> <configuration> <snapshotdirectory>${project.build.directory}/test-classes</snapshotdirectory> <propertyname>jacocoargs</propertyname> </configuration> <executions> <execution> <id>jacoco-initialize</id> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>jacoco-site</id> <phase>package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin>
gwttestcase
public class gwttestcovergesample extends gwttestcase { public string getmodulename() { return "com.test.sample.covergesamplejunit"; } public void testfieldverifier() { } public void testgreetingservice() { greetingserviceasync greetingservice = gwt.create(greetingservice.class); servicedeftarget target = (servicedeftarget) greetingservice; target.setserviceentrypoint(gwt.getmodulebaseurl() + "covergesample/greet"); delaytestfinish(10000); greetingservice.greetserver("gwt user", new asynccallback<string>() { public void onfailure(throwable caught) { system.out.println("gwttestcovergesample.testgreetingservice().new asynccallback() {...}.onfailure()"); fail("request failure: " + caught.getmessage()); } public void onsuccess(string result) { asserttrue(result.startswith("hello, gwt user!")); finishtest(); } }); } }
coveragesamplejunit.gwt.xml
<?xml version="1.0" encoding="utf-8"?> <module rename-to="covergesample"> <inherits name='com.test.sample.covergesample' /> <servlet path="/covergesample/greet" class="com.test.sample.server.greetingserviceimpl" /> </module>
in target folder, can see site folder getting created correct report index.html file. when open index.html file coverage report 0%. please help.
Comments
Post a Comment