Hi,
The performCoverageCheck task in cobertura plugin is always skipped, even though i have valid test class file.I have included my test class in my source folder itself. Below the source below:
Can anyone help me on this.
build.gradle
buildscript {
repositories {
maven { url “https://plugins.gradle.org/m2/” }
}
dependencies {
classpath ‘net.saliman:gradle-cobertura-plugin:2.3.0’
}
}
repositories {
mavenCentral()
}
dependencies {
compile ‘junit:junit:4.10’
}
sourceSets {
main {
java {
srcDir ‘src’
}
}
}
cobertura {
coverageFormats = [‘html’]
coverageIgnoreTrivial = true
coverageReportDir = new File("$buildDir/reports/cobertura")
coverageSourceDirs =[‘src’]
}
src/CoberturaSample.java
package com.test.cobertura;
public class CoberturaSample {
public int add(int a,int b){
return a+b;
}
}
src/CoberturaSampleTest.java
package com.test.cobertura;
import static org.junit.Assert.*;
import org.junit.Test;
import com.test.cobertura.CoberturaSample;
public class CoberturaSampleTest {
@Test
public void testAdd() {
int a=1,b=2;
int intexpected = a+b;
CoberturaSample objCobtSam = new CoberturaSample();
int actual = objCobtSam.add(a, b);
assertEquals(intexpected, actual);
}
}
Many thanks in advance.