Skip to content

Commit 2689ff4

Browse files
committed
simple acceptance test
1 parent d1fc3ac commit 2689ff4

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ task sourcesJar(type: Jar) {
4444
classifier = 'sources'
4545
}
4646

47+
test {
48+
dependsOn jar
49+
}
50+
4751
artifacts {
4852
archives jar
4953
archives groovydocJar
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.scoverage
2+
3+
import org.gradle.tooling.GradleConnector
4+
import org.junit.Test
5+
6+
import static org.junit.Assert.assertThat
7+
import static org.hamcrest.core.Is.is
8+
9+
class PluginAcceptanceTest {
10+
11+
@Test
12+
public void testProjectWithCompleteCoverage() throws Exception {
13+
def build = GradleConnector.
14+
newConnector().
15+
forProjectDirectory(new File("src/test/happyday")).
16+
connect().newBuild()
17+
build.forTasks('clean', 'checkScoverage').run()
18+
19+
def html = new File('src/test/happyday/build/reports/scoverage/index.html')
20+
assertThat('an HTML file should be created at ' + html.absolutePath, html.exists(), is(true))
21+
}
22+
}

src/test/happyday/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
description = 'a project that builds successfully with 100% coverage'
2+
3+
buildscript {
4+
repositories {
5+
// need to get up to the working directory of gradle-plugins build
6+
flatDir dir: "${project.projectDir}/../../../build/libs"
7+
}
8+
dependencies {
9+
classpath name: 'gradle-scoverage', version: '+'
10+
}
11+
}
12+
13+
apply plugin: 'scoverage'
14+
15+
repositories {
16+
mavenCentral()
17+
}
18+
19+
dependencies {
20+
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:0.99.5'
21+
compile 'org.scala-lang:scala-library:2.11.0'
22+
testCompile 'junit:junit:4.11'
23+
}
24+
25+
checkScoverage {
26+
minimumLineRate = 1.0
27+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package hello
2+
3+
object World {
4+
def say() = println("ahoy")
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package hello
2+
3+
import org.junit.Test
4+
5+
class WorldTest {
6+
@Test
7+
def bob() {
8+
World.say()
9+
}
10+
}

0 commit comments

Comments
 (0)