Until then, anyone using FunSuite can borrow this code and temporarily use MiniFunSuite instead. This all seems to work quite well.
Here's the client/test code:
class FunSuiteExample extends FunSuiteTestNGAdapter{
test("hey"){ println("hey") }
test("fail"){ assert( 1 === 2 ) }
}
And here's the library code:
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{DataProvider, Test}
trait MiniFunSuite{
var testMap = Map[String, Function0[Unit]]()
def test(name:String)(f: => Unit) = testMap += (name -> f _)
}
trait FunSuiteTestNGAdapter extends MiniFunSuite with TestNGSuite{
@DataProvider{ val name="tests" }
def tests = testMap.map{ case (s,f) => Array(s,f) }.toList.toArray
@Test{ val dataProvider = "tests" }
def scalaTest(testName:String, f: => Unit) = { f }
}
Nice work using test-ng.
ReplyDeleteI did something similar a little while back, writing a junit4runner to run my scalatests from IDEs and Maven. It works with all the different test-traits in scalatest.
http://github.com/teigen/scalatest-junit4runner/tree/master
http://www.artima.com/forums/flat.jsp?forum=284&thread=254074