0 Replies Latest reply on Oct 23, 2011 3:43 PM by dmiklancic

    Deployment configuration causes invalid test result status

    dmiklancic

      The  deployment shown below and the tests (not shown), work fine.  However, if a change such as removing the common-logging artifact is made, the tests do not run, yet the test results report is: Tests run: 3, Failures: 0, Errors: 0, Skipped: 0.  In fact, even if the tests fail, they are still reported as successful runs.

       

      Excluding a required dependency should rightfully generate an exception, and in fact, one is raised, but it neither seems to be visible in any of the test results nor causes the test(s) to fail.  When I remotely debug the code, I can see the exception that is raised (InvocationTargetException).  For some reason, the exception is swallowed, all subsequent tests are skipped, and the the test results are reported as mentioned above--Tests run: 3, Failures: 0, Errors: 0, Skipped: 0.

       

      It seems that the test(s) should fail on a deployment configuration error such as the one mentioned.  Is this a bug, or do I not understand something about how such errors are handled and reported? 

       

      It would be nice to be notified that an exception was thrown in the container so one could see it and realize that a required class, package, or jar is missing from the deployment.  Having to step through the debugger to see such exceptions is quite tedious and time consuming. 

       

      I am using the following configuration:

       

             <dependency>

                  <groupId>org.jboss.arquillian.testng</groupId>

                  <artifactId>arquillian-testng-container</artifactId>

                  <version>1.0.0.CR5</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.shrinkwrap.resolver</groupId>

                  <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

                  <version>1.0.0-beta-5</version>

                  <scope>test</scope>

              </dependency>

             <dependency>

                   <groupId>org.jboss.as</groupId>

                    <artifactId>jboss-as-arquillian-container-managed</artifactId>

                    <version>7.0.2.Final</version>

                    <scope>test</scope>

              </dependency>

       

      @Deployment

          public static Archive<?> createTestArchive() {

              WebArchive war = ShrinkWrap

                      .create(WebArchive.class, "test.war")

                      .addClasses(QuantityDimension.class, QuantityDimensionDataService.class,

                              QuantityDimensionDataServiceBean.class, GenericDataService.class,

                              AbstractDataServiceBean.class, Resources.class, SQLStatementBuilder.class)

                      .addPackage(DbUnitManager.class.getPackage())

                      .addAsLibraries(

                              DependencyResolvers.use(MavenDependencyResolver.class).artifact("org.slf4j:slf4j-api:1.6.1")

                                      .artifact("org.slf4j:slf4j-log4j12:1.6.1")

                                      .artifact("org.dbunit:dbunit:2.4.8")

                                      .artifact("commons-logging:commons-logging:1.1.1")

                                      .artifact("org.hsqldb:hsqldb:2.2.4")

                                      .resolveAs(GenericArchive.class))

                      .addAsResource("log4j.xml", ArchivePaths.create("log4j.xml"))

                      .addAsResource(new File("target/test-classes/connection.properties"), "connection.properties")

                      .addAsResource(new File("src/test/resources/data/QuantityDimension_DataServiceTestData.xml"),

                              "/data/QuantityDimension_DataServiceTestData.xml")

                      .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")

                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

              System.out.println(war.toString(true));

              return war;

          }