Domanda

I'm not seeing my report after running gradle test.

My build script is:

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" )
  }
}

And my test looks like:

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
  }
}

This builds correctly but the summary is not found. Issuing gradle test -i reveals that there is a missing source:

~/Projects/playground/build/classes/test', not found
Skipping task ':test' as it has no source files.

Sure there's something silly missing...

È stato utile?

Soluzione

Chances are that you put the test source file into the wrong directory. By default, Scala test sources are expected to reside under src/test/scala.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top