Bug 474636 - [JUnit] Tests in a class using Enclosed test-runner are executed twice when started at the package level
Summary: [JUnit] Tests in a class using Enclosed test-runner are executed twice when s...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-10 14:19 EDT by Stephen Flynn CLA
Modified: 2023-05-02 11:56 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Flynn CLA 2015-08-10 14:19:17 EDT
Tests that are organized into static inner classes when using the test-runner Enclosed are being executed twice when using the Run As -> JUnit Test at the package level or higher.

In order to replicate the bug, create a class using the following code:

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;

@RunWith(Enclosed.class)
public class IAmATestOuter {

	public static class IAmATestInner {
		@Test
		public void test() {
			assertEquals(1, 1);
		}
	}
}

Run the test by right clicking the class; selecting IAmATestOuter or IAmATestInner will run the test once.

Run the test by right clicking the package; the test is run twice.
Comment 1 Eclipse Genie CLA 2019-05-11 15:28:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Dani Megert CLA 2019-05-12 12:51:57 EDT
Kalyan, please check whether this is still an issue.
Comment 3 Kalyan Prasad Tatavarthi CLA 2019-05-16 06:10:58 EDT
(In reply to Dani Megert from comment #2)
> Kalyan, please check whether this is still an issue.

This is still an issue.
Comment 4 Eclipse Genie CLA 2021-05-06 12:49:23 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2023-05-02 11:56:45 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.