The Scala.js TestNG plugin is a way to overcome the lack of annotation
information of any test class (usually accessed through reflection).
This is all the information required by the Scala.js testing framework to
execute the tests.
As an example we take the following test class:
class Foo {
@BeforeMethod def before(): Unit = {
// Initialize the instance before the tests
}
@Test def bar(): Unit = {
// assert some stuff
}
@Test(enabled = false) def baz(): Unit = {
// assert some other stuff
}
}
object Foo {
@BeforeClass def beforeClass(): Unit = {
// Initialize some global state for the tests.
}
}
The test framework will identify Foo$scalajs$testng$bootstrapper as a test module
because it extends TestNGTestBootstrapper. It will know which methods to run based
on the info returned by Foo$scalajs$testng$bootstrapper.metadata,
it will create new test instances using Foo$scalajs$testng$bootstrapper.newInstance()
and it will invoke test methods using invoke on the bootstrapper.
The Scala.js TestNG plugin is a way to overcome the lack of annotation information of any test class (usually accessed through reflection). This is all the information required by the Scala.js testing framework to execute the tests.
As an example we take the following test class:
Will generate the following bootstrapper module:
The test framework will identify
Foo$scalajs$testng$bootstrapper
as a test module because it extendsTestNGTestBootstrapper
. It will know which methods to run based on the info returned by Foo$scalajs$testng$bootstrapper.metadata, it will create new test instances usingFoo$scalajs$testng$bootstrapper.newInstance()
and it will invoke test methods usinginvoke
on the bootstrapper.