Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 384611

Summary: JUnit 3 Suite generation fails when test cases contain TestSetup
Product: [Eclipse Project] JDT Reporter: Jan Wloka <jan.wloka>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, reprogrammer
Version: 3.7.2   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Jan Wloka CLA 2012-07-09 10:18:28 EDT
Build Identifier: M20120208-0800

When generating a new test suite for a selected package with existing test cases the newly created suite contains compile errors if a test case contains a test setup as shown below: 

public class FooTest extends TestCase {
	public static class FooTestSetup extends TestSetup {
		public FooTestSetup(Test test) { super(test); }
		protected void setUp() throws Exception {
			super.setUp();
			// do heavy setup here
		}
		protected void tearDown() throws Exception {
			super.tearDown();
		}
	}
	
	public static Test suite() {
		return new FooTestSetup(new TestSuite(FooTest.class));
	}
	
	public void testScenario1() throws Exception {
		// do some testing here
	}
}


The generated suite would look as follows:
public class AllTests {
	public static Test suite() {
		TestSuite suite= new TestSuite(AllTests.class.getName());
		//$JUnit-BEGIN$
		suite.addTest(BarTest.suite());
		suite.addTestSuite(BarTestSetup.class);
		suite.addTest(FooTest.suite());
		suite.addTestSuite(FooTestSetup.class);
		//$JUnit-END$
		return suite;
	}
}

Both setups should not be added to the suite.




Reproducible: Always

Steps to Reproduce:
1. Create a test package the also contain test classes as shown above
2. Right click on the package, and select New > JUnit Test Suite
3. In the shown dialog check 'New JUnit 3 suite'
4. Click on Finish
Comment 1 Ayushman Jain CLA 2012-07-09 10:21:37 EDT
Moving to JDT/UI
Comment 2 Eclipse Genie CLA 2019-10-27 14:34:36 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.