I have few classes of junit tests that I wanna use the testwatcher class with like so

class A extends C { @Test def testA = { //tests } }

class B

class B extends C{ @Test def testB ={ //tests } }

Class C is below

trait C extends TestWatcher { override def failed(er:Throwable, des:Description) { val writer = new FileWriter(new File("D:\\test_"+des.getMethodName+".txt" )) writer.write("false") writer.close() } override def succeeded(des:Description) { val writer = new FileWriter(new File("D:\\test_"+des.getMethodName+".txt" )) writer.write("true") writer.close() } }

It seems that when I run the tests, the succeeded and fail methods in C are never ran and the files are never created.

I have also tried using @RunWith(classOf[JUnitRunner]) but that doesn't work either

Any ideas?