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

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

    Details

      Description

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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  kpiwko Karel Piwko
                • Votes:
                  7 Vote for this issue
                  Watchers:
                  13 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: