You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Mohammed Nadeem <na...@gmail.com> on 2018/10/06 20:24:38 UTC

Re: Code coverage for NiFi processor

Hi James,

Yes, I had used JaCoCo plugin to get the code coverage for the mocked Junit
testcases written. Copy below details to the nifi-custom-processors pom.xml
file.

<properties>
	<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>

<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
	<sonar.language>java</sonar.language>
</properties>

<plugin>
	<groupId>org.jacoco</groupId>
	<artifactId>jacoco-maven-plugin</artifactId>
	<version>0.7.5.201505241946</version>
	<executions>
		<execution>
			<id>pre-unit-test</id>
			<goals>
				<goal>prepare-agent</goal>
			</goals>
			<configuration>
				<append>true</append>
				<propertyName>surefireArgLine</propertyName>
			</configuration>
		</execution>
		<execution>
			<id>post-unit-test</id>
			<phase>test</phase>
			<goals>
				<goal>report</goal>
			</goals>
			<configuration>
				<dataFile>${sonar.jacoco.reportPath}</dataFile>
				<append>true</append>
			</configuration>
		</execution>
	</executions>
</plugin>
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>2.15</version>
	<configuration>
		<argLine>${surefireArgLine}</argLine>
		
		<skipTests>${skip.unit.tests}</skipTests>
	</configuration>
</plugin>

Since I had used SonarQube for code quality check and code coverage, you
could leverage this or some other platform such as travis-cl build

Regards,
Nadeem



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/