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

@ArquillianResource in TestNG based tests causes test body not to be evaluated

XMLWordPrintable

      Suppose following test case:

      public class LowercaseConverterTest extends Arquillian {
      
      	@Inject
      	private LowercaseConverter lowercaseConverter;
      
      	@Deployment
      	public static JavaArchive createTestArchive() {
      
      		return ShrinkWrap
      				.create(JavaArchive.class, "test.jar")
      				.addClasses(LowercaseConverter.class)
      				.addAsManifestResource(EmptyAsset.INSTANCE,
      						ArchivePaths.create("beans.xml"));
      	}
      
      	@Test
      	public void testConvertToLowercase() {	    
      	    
      		Assert.assertEquals("martin",
      				lowercaseConverter.convertToLowercase("Martin"));
      	}
      }
      

      However, if @ArquillianResource is used for a field injection, such as:

      @ArquillianResource URL field;	
      

      than test body is no longer executed and all tests are reported as passed even an obvious failure like:

      @Test
      	public void testConvertToLowercase() {	    
      	    
      	    Assert.fail();
      	    
      		Assert.assertEquals("karel",
      				lowercaseConverter.convertToLowercase("Martin"));
      	}
      

              Unassigned Unassigned
              kpiwko Karel Piwko
              Votes:
              7 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: