You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Erik Putrycz (JIRA)" <ji...@codehaus.org> on 2008/03/27 16:03:58 UTC
[jira] Created: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
@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
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
[jira] Commented: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "Ingomar Otter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196322#action_196322 ]
Ingomar Otter commented on SUREFIRE-479:
----------------------------------------
I second that, same effect here.
> @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
[jira] Closed: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Fabulich closed SUREFIRE-479.
---------------------------------
Resolution: Cannot Reproduce
I can't reproduce this. I've attached a sample Maven project that follows your guidelines with println commands in init, cleanup and testSomething. When I run "mvn test" in that project, I see:
init
something
cleanup
which tells me that TestNG is working correctly. If you don't see that in your output, please reopen the bug.
> @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.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
[jira] Commented: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "nodje (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158682#action_158682 ]
nodje commented on SUREFIRE-479:
--------------------------------
I met the problem as well.
I uploaded a test case that reproduce the problem.
It does only appear (in my case) when you use a group though.
If you don't specify the group in the @BeforeClass annotation as well, the annotated method won't be called.
The behaviour is different without using Surefire: the @BeforeClass annotation would be taken into account regardless of the specified group.
I'm glad I figured this one, I was pretty stuck!
> @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.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
[jira] Issue Comment Edited: (SUREFIRE-479) @BeforeClass and
@AfterClass on parent class are not executed
Posted by "nodje (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=158682#action_158682 ]
nodje edited comment on SUREFIRE-479 at 12/19/08 12:28 AM:
-----------------------------------------------------------
I met the problem as well.
I uploaded a test case that reproduce the problem.
It does only appear (in my case) when you use a group though.
If you don't specify the group in the @BeforeClass annotation as well, the annotated method won't be called.
The behaviour is different without using Surefire: the @BeforeClass annotation would be taken into account regardless of the specified group.
Is it possible to reopen the issue?
A good workaround for the time being is to add groups to @BeforeXXX annotation: @BeforeClass(groups = "xml").
was (Author: nodje):
I met the problem as well.
I uploaded a test case that reproduce the problem.
It does only appear (in my case) when you use a group though.
If you don't specify the group in the @BeforeClass annotation as well, the annotated method won't be called.
The behaviour is different without using Surefire: the @BeforeClass annotation would be taken into account regardless of the specified group.
I'm glad I figured this one, I was pretty stuck!
> @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
[jira] Updated: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "nodje (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
nodje updated SUREFIRE-479:
---------------------------
Attachment: surefire479-withGrp.zip
> @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
[jira] Commented: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "Reimer Prochnow (JIRA)" <ji...@codehaus.org>.
[ 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
[jira] Updated: (SUREFIRE-479) @BeforeClass and @AfterClass on
parent class are not executed
Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Fabulich updated SUREFIRE-479:
----------------------------------
Attachment: surefire479.zip
> @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.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