Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-1862

Scalatest TestRunner

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

      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:

      @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")
        }
      }
      

      This run the test with TestNG and bootstrap arquillian, but can't use other format spec

      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")
        }
      }
      

            Unassigned Unassigned
            giovannicandido Giovanni Silva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: