[ 
http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225747#action_225747
 ] 

Reimer Prochnow commented on SUREFIRE-479:
------------------------------------------

using surefire 2.5 with testng 5.12.1 I ran into this behavior.
While using @BeforeClass the test runs fine, but specifying a suiteXmlFile 
whith a testng.xml containing a group, the @BeforeClass method was not called 
anymore. This behavior is indeed a feature, see the testng documentation:
"alwaysRun: For before methods (beforeSuite, beforeTest, beforeTestClass and 
beforeTestMethod, but not beforeGroups): If set to true, this configuration 
method will be run regardless of what groups it belongs to"

So use
@BeforeClass(alwaysRun = true)


> @BeforeClass and @AfterClass on parent class are not executed
> -------------------------------------------------------------
>
>                 Key: SUREFIRE-479
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-479
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.4.2
>            Reporter: Erik Putrycz
>         Attachments: surefire479-withGrp.zip, surefire479.zip
>
>
> I have 
> public abstract class A {
>    @BeforeClass
>    public void init() {...}
>    @AfterClass
>    public void cleanup() {...}
> }
> and 
> @Test
> public class TestA extends A {
>   public void testSomething() {...}
> }
> when surefire executes testSomething, the @BeforeClass and @AfterClass are 
> never being called. I have testng 5.7.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to