You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dan Fabulich (JIRA)" <ji...@codehaus.org> on 2007/12/09 04:42:57 UTC

[jira] Closed: (SUREFIRE-395) 2.4-SNAPSHOT does not execute TestNG suite/test in correct order,

     [ http://jira.codehaus.org/browse/SUREFIRE-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich closed SUREFIRE-395.
---------------------------------

    Resolution: Duplicate

Duplicate of SUREFIRE-396

> 2.4-SNAPSHOT does not execute TestNG suite/test in correct order, 
> ------------------------------------------------------------------
>
>                 Key: SUREFIRE-395
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-395
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Elias Ross
>         Attachments: testsf-testng.zip
>
>
> Please view and the attached .zip file containing two TestNG tests and one "Base" TestNG test.
> Here is the output with 2.4-SNAPSHOT:
> $ mvn test
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> [Parser] Running:
>   Command line suite
> Running Command line suite
> beforeSuite
> beforeTest com.autodesk.testsf.SF2Test@14b7453
> SF2Test.testTrue
> SFTest.testTrue
> afterTest com.autodesk.testsf.SF2Test@14b7453
> afterSuite
> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.125 sec <<< FAILURE!
> With 2.4-collab-SNAPSHOT:
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> [Parser] Running:
>   Command line suite
> beforeSuite
> Running com.autodesk.testsf.SFTest
> beforeTest com.autodesk.testsf.SFTest@1690726
> SFTest.testTrue
> afterTest com.autodesk.testsf.SFTest@1690726
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
> Running com.autodesk.testsf.SF2Test
> beforeTest com.autodesk.testsf.SF2Test@1820dda
> SF2Test.testTrue
> afterTest com.autodesk.testsf.SF2Test@1820dda
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
> afterSuite
> Results :
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
> SFTest and SF2Test both extend from BaseTest:
> public abstract class BaseTest {
> 	protected boolean test = false;
> 	private static boolean suite = false;
> 	@BeforeSuite
> 	public static void beforeSuite() throws Exception {
> 		System.out.println("beforeSuite");
> 		suite = true;
> 	}
> 	
> 	@AfterSuite
> 	public static void afterSuite() throws Exception {
> 		System.out.println("afterSuite");
> 		if (!suite)
> 			throw new IllegalStateException();
> 		suite = false;
> 	}
> 	
> 	@BeforeTest
> 	public void beforeTest() throws Exception {
> 		System.out.println("beforeTest " + this);
> 		if (test)
> 			throw new IllegalStateException();
> 		if (!suite)
> 			throw new IllegalStateException();
> 		test = true;
> 	}
> 	@AfterTest
> 	public void afterTest() {
> 		System.out.println("afterTest " + this);
> 		test = false;
> 	}
> }
> @Test
> public class SFTest extends BaseTest {
> 	
> 	@Test
> 	public void testTrue() {
> 		System.out.println("SFTest.testTrue");
> 		assertEquals(this.test, true);
> 	}
> }
> @Test
> public class SF2Test extends BaseTest {
> 	
> 	@Test
> 	public void testTrue() {
> 		System.out.println("SF2Test.testTrue");
> 		assertEquals(this.test, true);
> 	}
> }
>  ... Can somebody explain the discrepancy? If not, this appears to be a bug

-- 
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