scala - How to add 'testListener' to custom test reporter in SBT -


i'm having difficulty implementing custom test reporter in scala using sbt.

i have basic sbt project set build.sbt file:

name := "test framework"  version := "0.1" scalaversion := "2.11.7"  scalacoptions += "-deprecation" scalacoptions += "-feature"  librarydependencies += "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test" librarydependencies += "org.scalacheck" %% "scalacheck" % "1.12.4" % "test"   testframeworks += new testframework("custom.framework.mytest") testlisteners += new mytest() 

my mytest.scala class located in projectsfolder under projects/custom/framework/mytest.scala , looks this:

import sbt.testslistener._ import sbt.testreportlistener._  class mytest extends testreportlistener {      def doinit(): unit = {         println("starting test")     }      def testevent(event: testevent): unit = {         println(event.result.get)     }      def startgroup(name: string): unit = {         println("group started")     } } 

the documentation here sparse, , i'm missing something. states need

specify test reporters want use overriding testlisteners setting in project definition. customtestlistener of type sbt.testreportlistener.

this should possible doing testlisteners += customtestlistener. since class mytest extends testreportlistener thought testlisteners += custom.framework.mytest or testlisteners += new custom.framework.mytest, not case.

i'm running sbt test execute tests, , output is

error: not found: value custom testlisteners += new custom.framework.mytest 

i'm not sure how supposed work. know how done correctly?

i did not figure out why stating package did not work, moving mytest.scala file out project directory, , removing custom.frameworkpackage made work.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -