运行gradle test
后,我没有看到我的报告。
我的构建脚本是:
apply plugin: 'scala'
archivesBaseName = 'playground'
repositories {
mavenLocal()
mavenCentral()
maven{
url 'http://conjars.org/repo/'
artifactUrls 'http://clojars.org/repo/'
artifactUrls 'http://maven.twttr.com/'
}
}
dependencies {
compile 'org.scala-lang:scala-compiler:2.9.2'
compile 'org.scala-lang:scala-library:2.9.2'
compile 'org.apache.hadoop:hadoop-core:1.2.1'
compile 'com.twitter:scalding_2.9.2:0.8.1'
compile 'cascading:cascading-core:2.1.6'
compile 'cascading:cascading-hadoop:2.1.6'
testCompile 'org.testng:testng:6.8.7'
testCompile 'org.easytesting:fest-assert:1.4'
testCompile 'org.scala-tools.testing:specs:1.6.2.2_1.5.0'
}
test {
useTestNG()
}
jar {
description = "Assembles a Hadoop-ready JAR file"
into( 'lib' ) {
from configurations.compile
}
manifest {
attributes( "Main-Class": "com.twitter.scalding.Tool" )
}
}
我的测试看起来像:
import com.twitter.scalding.{FieldConversions, Tsv, JobTest, TupleConversions}
import cascading.tuple.Fields
import org.testng.annotations.Test
import org.scalatest.testng.TestNGSuite
import runner._
class NameSumTest extends TestNGSuite{
@Test
def testNameSum() = {
val inputFileName = "inputFile.txt"
val outputFileName = "outputFile.txt"
val data = List(
("John", "Doe")
("Joan", "Moore")
("Michel", "Jackson")
)
JobTest("org.playground.NameSum").
arg("input", inputFileName).
arg("output", outputFileName).
source(Tsv(inputFileName, ('firstName, 'lastName)), data).
sink[(String, String)](Tsv(outputFileName)) {
ob =>
val map = ob.toMap[String, String]
assert(map("John") == 1)
}
}.run.finish
}
}
这构建正确但未找到摘要。
发布gradle test -i
表明缺少来源:
~/Projects/playground/build/classes/test', not found
Skipping task ':test' as it has no source files.
当然有一些愚蠢的遗漏...
答案 0 :(得分:1)
您可能会将测试源文件放入错误的目录中。默认情况下,Scala测试源应位于src/test/scala
。