You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Konstantin Boudnik (JIRA)" <ji...@apache.org> on 2009/07/08 02:35:14 UTC

[jira] Commented: (HADOOP-4901) Upgrade to JUnit 4

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

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

Here's a comment on JUnitExt remarks. It seems that JUnit Extension project supports the categorization of some kind. However, it seems that the semantic of their @Category is very different from our desire for tagging is. Here's the excerpt from JUnitExt tutorial:

{panel:title=JUnitExt tutorial's excerpt}
How to use categories

Tests can be categorized, to sort them for different puporses. JUnitExt provides a CategoryTextListerner, which prints out at end of test run all categories, with status of tests listed: May be Success, Ignored, Failed. You can plugin the category text listener using following code: (see also org.junitext.samples package)

	JUnitCore core = new JUnitCore();
	// use for categories special listener, give some statistics
	core.addListener(new CategoryTextListener(System.out));
	core.run(SimpleTest.class);

The output when running thes tests will be:

I.
Time: 0

OK (1 test)

Category: equal tests
  Success testEquals(org.junitext.samples.SimpleTest)
Category: math tests
  Ignored divideByZero(org.junitext.samples.SimpleTest)
{panel}

It might be possible to extend or develop new ClassRunner which will be capable of running only tests from a specified @Category, however it isn't provided by JUnitExt out of the box or the documentation fails no mention it.


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