[infinispan-issues] [JBoss JIRA] (ISPN-3078) @AfterMethod/alwaysRun and alike are not used correctly

Dan Berindei (JIRA) jira-events at lists.jboss.org
Thu May 9 15:10:53 EDT 2013


    [ https://issues.jboss.org/browse/ISPN-3078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773314#comment-12773314 ] 

Dan Berindei commented on ISPN-3078:
------------------------------------

Looks like {{@BeforeMethod}}/{{@AfterMethod}} methods don't actually run for tests that are in an inactive group, only {{@BeforeTest}}/{{@AfterTest}}.

On the other hand, if the test method fails and {{alwaysRun == false}}, the {{@AfterMethod}} method will not run, almost certainly causing a leak.
                
> @AfterMethod/alwaysRun and alike are not used correctly 
> --------------------------------------------------------
>
>                 Key: ISPN-3078
>                 URL: https://issues.jboss.org/browse/ISPN-3078
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Test Suite
>    Affects Versions: 5.3.0.Beta1
>            Reporter: Mircea Markus
>            Assignee: Mircea Markus
>             Fix For: 5.3.0.Beta2
>
>
> alwaysRun=true makes the invocation of that method to happen even if the test that has the method is not in the running group:http://testng.org/javadoc/org/testng/annotations/BeforeMethod.html#alwaysRun()
> E.g. if I want to run the "xsite" groups, all the @AfterMethod(alwaysRun=true) from the "functional" groups are also invoked, most likely causing NPEs as the resources from this tests haven't been initialised. So unless used for an abstract test class that would be extended by multiple classes from different groups, I don't see any point in using "alwaysRun" on neither @BeforeMethod nor on @AfterMethod.
> This is causing the suite to exit:
> {quote}
> [14:53:10][org.infinispan:infinispan-server-core] 
> [14:53:10][org.infinispan:infinispan-server-core] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> [14:53:10][org.infinispan:infinispan-server-core] !!!!!! (testng-MarshallingTest) Exiting because MarshallingTest has NOT shut down all the cache managers it has started !!!!!!!
> [14:53:10][org.infinispan:infinispan-server-core] !!!!!! (testng-MarshallingTest) The still-running cacheManager was created here: org.infinispan.server.core.AbstractMarshallingTest.setUp(AbstractMarshallingTest.scala:49) !!!!!!!
> [14:53:10][org.infinispan:infinispan-server-core] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> {quote}
> AbstractMarshallingTest.tearDown is always invoked(always=true) so I don't know why this doesn't get cleaned up. Anyway better to use TestUtil.killCacheManager(..) for handling this.
>  
> http://ci.infinispan.org/viewLog.html?buildId=1005&buildTypeId=bt2&tab=buildLog#_focus=27336

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the infinispan-issues mailing list