hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Boudnik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-4901) Upgrade to JUnit 4
Date Wed, 08 Jul 2009 01:03:14 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-4901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12728453#action_12728453
] 

Konstantin Boudnik commented on HADOOP-4901:
--------------------------------------------

I've done some additional investigation on Spring-test framework and it seems that the tagging
solution is already in place there. Here's an example:

{code:title=MyTests.java}
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners( {})
public class MyTests {
	@BeforeClass
	public static void setUp() {
		System.out.println("test-group is set to: " + System.getProperty("test-group"));
	}

	@Test
	@IfProfileValue(name = "test-group", values = { "fast", "quick" })
	public void testOne() {
		System.out.println("testOne(): Quick stuff");
	}

	@Test
	@IfProfileValue(name = "test-group", value = "fast")
	public void testTwo() {
		System.out.println("testTwo(): Fast stuff");
	}
}
{code}

then to run say 'fast' tests one just need to specify -Dtest-group=fast at run time.

This solution requires a couple of jars to be pulled down from Maven repo, but other than
that is it quite clear and easy to implement.

I have found a couple of the issues with Spring-test framework which will affect this approach
or at least might slightly postpone it. See http://jira.springframework.org/browse/SPR-5145
and but the fix is coming in the release 3.0 of Spring, which is around the corner. 

Other minor issues are: http://jira.springframework.org/browse/SPR-5902, http://jira.springframework.org/browse/SPR-5903
but these are rather improvements than bugs.



> Upgrade to JUnit 4
> ------------------
>
>                 Key: HADOOP-4901
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4901
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: test
>            Reporter: Tom White
>            Assignee: Alex Loddengaard
>
> Amongst other things, JUnit 4 has better support for class-wide set up and tear down
(via @BeforeClass and @AfterClass annotations), and more flexible assertions (http://junit.sourceforge.net/doc/ReleaseNotes4.4.html).
It would be nice to be able to take advantage of these features in tests we write.
> JUnit 4 can run tests written for JUnit 3.8.1 without any changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message