]
Aslak Knutsen edited comment on ARQ-1862 at 10/8/14 3:30 AM:
-------------------------------------------------------------
[~giovannicandido] In the Spock example that is actually handled by the Interceptor, not
the Runner;
was (Author: aslak):
[~giovannicandido]In the Spock example that is actually handled by the Interceptor, not
the Runner;
Scalatest TestRunner
--------------------
Key: ARQ-1862
URL:
https://issues.jboss.org/browse/ARQ-1862
Project: Arquillian
Issue Type: Feature Request
Reporter: Giovanni Silva
Hi,
Would be great to have a Arquillian runner in the same way of JUnitRunner (to run with
Junit but with startup of Arquillian) or as native scalatest integration, not using
Junit.
Arquillian is great to test Context and Dependency Injections and Java EE components.
Current is possible to run arquillian using the JUnitRunner but it only start in Junit
test cases.
This run the FlatSpec test with JUnit, but do not bootstrap arquillian:
{code}
@RunWith(classOf[JUnitRunner])
class MySimpleBeamTestScala extends FlatSpec with Matchers {
@Inject
private var mysimplebeam: MySimpleBeam = _
"A simple bean" should "return hello world" in {
mysimplebeam.helloWorld() should be("Hello World")
}
@Test def testIsDeployed {
mysimplebeam.helloWorld() should be("Hell World")
}
}
object MySimpleBeamTestScala {
@Deployment
def createDeployment() = {
println("working")
ShrinkWrap.create(classOf[JavaArchive],
"test.jar").addClass(classOf[MySimpleBeam]).addAsManifestResource(EmptyAsset.INSTANCE,
"beans.xml")
}
}
{code}
This run the test with TestNG and bootstrap arquillian, but can't use other format
spec
{code}
import javax.inject.Inject
import org.jboss.arquillian.container.test.api.Deployment
import org.jboss.arquillian.testng.Arquillian
import org.jboss.shrinkwrap.api.ShrinkWrap
import org.jboss.shrinkwrap.api.asset.EmptyAsset
import org.jboss.shrinkwrap.api.spec.JavaArchive
import org.scalatest._
import org.testng.annotations.Test
/**
* @author Giovanni Silva
*/
class MySimpleBeamTestScala extends Arquillian with FlatSpecLike with Matchers {
@Inject
private var mysimplebeam: MySimpleBeam = _
"A simple bean" should "return hello world" in {
mysimplebeam.helloWorld() should be("Hello World")
}
@Test def testIsDeployed {
mysimplebeam.helloWorld() should be("Hell World")
}
}
object MySimpleBeamTestScala {
@Deployment
def createDeployment() = {
println("working")
ShrinkWrap.create(classOf[JavaArchive],
"test.jar").addClass(classOf[MySimpleBeam]).addAsManifestResource(EmptyAsset.INSTANCE,
"beans.xml")
}
}
{code}